Improve experience for Chatdoc (#4)
This commit is contained in:
1 parent
13e6918fa9
commit
0de86f2e09
68 files changed
+821
-117
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import axios, { AxiosProgressEvent, AxiosResponse } from 'axios';
|
||||
import {
|
||||
IChatdocChatResponse,
|
||||
IChatdocConversation,
|
||||
IChatdocConversationResponse,
|
||||
IChatdocConversationsResponse,
|
||||
IChatdocDocumentResponse,
|
||||
IChatdocDocumentsResponse,
|
||||
@@ -279,8 +279,8 @@ class ChatdocOperator {
|
||||
|
||||
async chatConversation(
|
||||
payload: { repositoryId: string; question: string; id?: string; knowledgeFallback?: boolean },
|
||||
options: { token: string; stream: (response: IChatdocChatResponse) => void }
|
||||
): Promise<AxiosResponse<IChatdocChatResponse>> {
|
||||
options: { token: string; stream: (response: IChatdocConversationResponse) => void }
|
||||
): Promise<AxiosResponse<IChatdocConversationResponse>> {
|
||||
return await axios.post(
|
||||
`/chatdoc/conversations`,
|
||||
{
|
||||
@@ -304,7 +304,7 @@ class ChatdocOperator {
|
||||
if (lastLine) {
|
||||
const jsonData = JSON.parse(lastLine);
|
||||
if (options?.stream) {
|
||||
options?.stream(jsonData as IChatdocChatResponse);
|
||||
options?.stream(jsonData as IChatdocConversationResponse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user