feat: app_code deficiency logic complete

This commit is contained in:
wb-lh513319
2024-08-13 15:50:03 +08:00
parent 4121b4965c
commit e7dcfead64

View File

@@ -22,7 +22,7 @@ type ChatParams = {
onError?: (content: string, error?: Error) => void; onError?: (content: string, error?: Error) => void;
}; };
const useChat = ({ queryAgentURL = '/api/v1/chat/completions', app_code = '' }: Props) => { const useChat = ({ queryAgentURL = '/api/v1/chat/completions', app_code }: Props) => {
const [ctrl, setCtrl] = useState<AbortController>({} as AbortController); const [ctrl, setCtrl] = useState<AbortController>({} as AbortController);
const { scene } = useContext(ChatContext); const { scene } = useContext(ChatContext);
const chat = useCallback( const chat = useCallback(
@@ -103,7 +103,7 @@ const useChat = ({ queryAgentURL = '/api/v1/chat/completions', app_code = '' }:
onError?.('Sorry, We meet some error, please try agin later.', err as Error); onError?.('Sorry, We meet some error, please try agin later.', err as Error);
} }
}, },
[queryAgentURL], [queryAgentURL, app_code],
); );
return { chat, ctrl }; return { chat, ctrl };