Skip to content

Commit b0d0782

Browse files
committed
fix : 응답 늦어지는 경우 처리
1 parent fc5d581 commit b0d0782

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/App.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ function App() {
3939
const msg = btnMsg || inputMsg;
4040

4141
try {
42-
const myChatResponse = await waitAtLeast(1500, sendUserChat(msg)); // TODO: make it Generic
42+
const myChatResponse = await waitAtLeast(1500, sendUserChat(msg)) as TypeResponseChat; // TODO: make it Generic
43+
if(myChatResponse.errorMessage) throw Error(myChatResponse.errorMessage);
4344
if (inputMsg) addChat(createReqChatFromMessage(inputMsg));
44-
addChat(createMyChatFromResponse(myChatResponse as TypeResponseChat));
45+
addChat(createMyChatFromResponse(myChatResponse));
4546
} catch (error) {
4647
if (inputMsg) addChat(createReqChatFromMessage(inputMsg));
4748
addChat(createMyChayChatFromError(error));

src/components/customs/Main/Chat/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export type TypeRequestChat = {
3131
};
3232

3333
export type TypeResponseChat = {
34+
errorMessage?: string;
3435
messages?: (TypeImageResponseCardMessage | TypePlainTextMessage | TypeLoadingMessage)[];
3536
metadatas?: { confidence: number };
3637
};

0 commit comments

Comments
 (0)