update fetch history

This commit is contained in:
AceDataCloud committed 2023-10-04 12:21:53 +08:00
1 parent 10f82c9ca2
commit 6c68c447c2
4 files changed
+53 -39

No files matched your search

+13 -7
View File
@@ -41,8 +41,8 @@ export interface IChatMessage {
error?: IError;
}
export interface IChatHistory {
conversation_id: string;
export interface IChatConversation {
id: string;
messages: IChatMessage[];
}
@@ -53,7 +53,7 @@ export interface IChatAskOptions {
path: string;
}
export interface IChatHistoryOptions {
export interface IChatConversationOptions {
endpoint: string;
path: string;
}
@@ -70,9 +70,15 @@ export interface IChatAskResponse {
conversation_id?: string;
}
export interface IChatHistoryRequest {
action: string;
conversation_id: string;
export enum IChatConversationAction {
RETRIEVE = 'retrieve',
UPDATE = 'update'
}
export type IChatHistoryResponse = IChatHistory;
export interface IChatConversationRequest {
action: IChatConversationAction;
id: string;
messages?: IChatMessage[];
}
export type IChatConversationResponse = IChatConversation;
+8 -2
View File
@@ -5,7 +5,10 @@ import {
IChatAskOptions,
IChatAskRequest,
IChatAskResponse,
IChatHistoryOptions
IChatHistoryOptions,
IChatConversationRequest,
IChatConversationOptions,
IChatConversationResponse
} from './models';
class ChatOperator {
@@ -32,7 +35,10 @@ class ChatOperator {
});
}
async history(data: IChatHistoryRequest, options: IChatHistoryOptions): Promise<AxiosResponse<IChatHistoryResponse>> {
async conversations(
data: IChatConversationRequest,
options: IChatConversationOptions
): Promise<AxiosResponse<IChatConversationResponse>> {
return await axios.post(options.path, data, {
headers: {
'content-type': 'application/json'