-
+ if (error.data.no_results) {
+ return (
+
+
+
+
+
+
+
+ No results found
+
+
+ Sorry, I don't know how to help with that. You can visit the{' '}
+
+ Nx documentation
+ {' '}
+ for more info.
+
+
-
-
- Oopsies! I encountered an error
-
-
{error['message']}
+
+ );
+ } else {
+ return (
+
+
+
+
+
+
+
+ Oopsies! I encountered an error
+
+
{error['message']}
+
-
- );
+ );
+ }
}
diff --git a/nx-dev/feature-ai/src/lib/feed-container.tsx b/nx-dev/feature-ai/src/lib/feed-container.tsx
index 531cf75821ff4..ee96f6517c5e4 100644
--- a/nx-dev/feature-ai/src/lib/feed-container.tsx
+++ b/nx-dev/feature-ai/src/lib/feed-container.tsx
@@ -2,7 +2,6 @@ import {
ChatItem,
getProcessedHistory,
queryAi,
- resetHistory,
sendFeedbackAnalytics,
sendQueryAnalytics,
} from '@nx/nx-dev/data-access-ai';
@@ -12,7 +11,6 @@ import { ErrorMessage } from './error-message';
import { Feed } from './feed/feed';
import { LoadingState } from './loading-state';
import { Prompt } from './prompt';
-import { WarningMessage } from './sidebar/warning-message';
import { formatMarkdownSources } from './utils';
interface LastQueryMetadata {
@@ -33,7 +31,7 @@ const assistantWelcome: ChatItem = {
export function FeedContainer(): JSX.Element {
const [chatHistory, setChatHistory] = useState
([]);
- const [hasError, setHasError] = useState(null);
+ const [queryError, setQueryError] = useState(null);
const [isLoading, setIsLoading] = useState(false);
const [lastQueryMetadata, setLastQueryMetadata] =
useState(null);
@@ -54,7 +52,7 @@ export function FeedContainer(): JSX.Element {
currentHistory.push({ role: 'user', content: query });
setIsLoading(true);
- setHasError(null);
+ setQueryError(null);
try {
const lastAnswerChatItem =
@@ -94,7 +92,7 @@ export function FeedContainer(): JSX.Element {
...aiResponse.usage,
});
} catch (error: any) {
- setHasError(error);
+ setQueryError(error);
}
setIsLoading(false);
@@ -122,12 +120,6 @@ export function FeedContainer(): JSX.Element {
});
};
- const handleReset = () => {
- resetHistory();
- setChatHistory([]);
- setHasError(null);
- };
-
return (
<>
{/*WRAPPER*/}
@@ -158,7 +150,7 @@ export function FeedContainer(): JSX.Element {
/>
{isLoading && }
- {hasError && }
+ {queryError && }
void;
}) {
+ const formRef = useRef(null);
+ const inputRef = useRef(null);
+ const [inputValue, setInputValue] = useState('');
+
+ useEffect(() => {
+ if (inputRef.current) {
+ inputRef.current.focus();
+ }
+ }, []);
+
return (
);
}
diff --git a/package.json b/package.json
index 9ed4d886e8594..d1ba1a0ba854f 100644
--- a/package.json
+++ b/package.json
@@ -245,6 +245,7 @@
"react-redux": "8.0.5",
"react-refresh": "^0.10.0",
"react-router-dom": "^6.11.2",
+ "react-textarea-autosize": "^8.3.0",
"regenerator-runtime": "0.13.7",
"resolve.exports": "1.1.0",
"rollup": "^2.56.2",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index e2ba96bdc3755..294e3ccb32295 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -814,6 +814,9 @@ devDependencies:
react-router-dom:
specifier: ^6.11.2
version: 6.11.2(react-dom@18.2.0)(react@18.2.0)
+ react-textarea-autosize:
+ specifier: ^8.3.0
+ version: 8.3.0(@types/react@18.2.14)(react@18.2.0)
resolve.exports:
specifier: 1.1.0
version: 1.1.0
@@ -24160,6 +24163,20 @@ packages:
refractor: 3.6.0
dev: false
+ /react-textarea-autosize@8.3.0(@types/react@18.2.14)(react@18.2.0):
+ resolution: {integrity: sha512-3GLWFAan2pbwBeoeNDoqGmSbrShORtgWfaWX0RJDivsUrpShh01saRM5RU/i4Zmf+whpBVEY5cA90Eq8Ub1N3w==}
+ engines: {node: '>=10'}
+ peerDependencies:
+ react: ^16.8.0 || ^17.0.0
+ dependencies:
+ '@babel/runtime': 7.22.6
+ react: 18.2.0
+ use-composed-ref: 1.3.0(react@18.2.0)
+ use-latest: 1.2.1(@types/react@18.2.14)(react@18.2.0)
+ transitivePeerDependencies:
+ - '@types/react'
+ dev: true
+
/react@18.2.0:
resolution: {integrity: sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==}
engines: {node: '>=0.10.0'}
@@ -27359,6 +27376,14 @@ packages:
tslib: 2.6.1
dev: true
+ /use-composed-ref@1.3.0(react@18.2.0):
+ resolution: {integrity: sha512-GLMG0Jc/jiKov/3Ulid1wbv3r54K9HlMW29IWcDFPEqFkSO2nS0MuefWgMJpeHQ9YJeXDL3ZUF+P3jdXlZX/cQ==}
+ peerDependencies:
+ react: ^16.8.0 || ^17.0.0 || ^18.0.0
+ dependencies:
+ react: 18.2.0
+ dev: true
+
/use-isomorphic-layout-effect@1.1.2(@types/react@18.2.14)(react@18.2.0):
resolution: {integrity: sha512-49L8yCO3iGT/ZF9QttjwLF/ZD9Iwto5LnH5LmEdk/6cFmXddqi2ulF0edxTwjj+7mqvpVVGQWvbXZdn32wRSHA==}
peerDependencies:
@@ -27372,6 +27397,20 @@ packages:
react: 18.2.0
dev: true
+ /use-latest@1.2.1(@types/react@18.2.14)(react@18.2.0):
+ resolution: {integrity: sha512-xA+AVm/Wlg3e2P/JiItTziwS7FK92LWrDB0p+hgXloIMuVCeJJ8v6f0eeHyPZaJrM+usM1FkFfbNCrJGs8A/zw==}
+ peerDependencies:
+ '@types/react': '*'
+ react: ^16.8.0 || ^17.0.0 || ^18.0.0
+ peerDependenciesMeta:
+ '@types/react':
+ optional: true
+ dependencies:
+ '@types/react': 18.2.14
+ react: 18.2.0
+ use-isomorphic-layout-effect: 1.1.2(@types/react@18.2.14)(react@18.2.0)
+ dev: true
+
/use-resize-observer@9.1.0(react-dom@18.2.0)(react@18.2.0):
resolution: {integrity: sha512-R25VqO9Wb3asSD4eqtcxk8sJalvIOYBqS8MNZlpDSQ4l4xMQxC/J7Id9HoTqPq8FwULIn0PVW+OAqF2dyYbjow==}
peerDependencies: