This commit is contained in:
archer
2023-07-18 11:50:16 +08:00
parent f9d83c481f
commit 505aff3dbf
26 changed files with 216 additions and 210 deletions

View File

@@ -10,7 +10,7 @@ import type { Props as UpdateHistoryProps } from '@/pages/api/chat/history/updat
/**
* 获取初始化聊天内容
*/
export const getInitChatSiteInfo = (data: { appId: string; historyId?: string }) =>
export const getInitChatSiteInfo = (data: { appId: string; chatId?: string }) =>
GET<InitChatResponse>(`/chat/init`, data);
/**
@@ -27,14 +27,14 @@ export const delChatHistoryById = (id: string) => GET(`/chat/removeHistory?id=${
/**
* get history quotes
*/
export const getHistoryQuote = (params: { historyId: string; contentId: string }) =>
export const getHistoryQuote = (params: { chatId: string; contentId: string }) =>
GET<(QuoteItemType & { _id: string })[]>(`/chat/history/getHistoryQuote`, params);
/**
* update history quote status
*/
export const updateHistoryQuote = (params: {
historyId: string;
chatId: string;
contentId: string;
quoteId: string;
sourceText: string;
@@ -43,7 +43,7 @@ export const updateHistoryQuote = (params: {
/**
* 删除一句对话
*/
export const delChatRecordByIndex = (data: { historyId: string; contentId: string }) =>
export const delChatRecordByIndex = (data: { chatId: string; contentId: string }) =>
DELETE(`/chat/delChatRecordByContentId`, data);
/**

View File

@@ -19,7 +19,7 @@ export const streamFetch = ({
new Promise<{
responseText: string;
errMsg: string;
newHistoryId: string | null;
newChatId: string | null;
[rawSearchKey]: QuoteItemType[];
}>(async (resolve, reject) => {
try {
@@ -45,7 +45,7 @@ export const streamFetch = ({
let responseText = '';
let rawSearch: QuoteItemType[] = [];
let errMsg = '';
const newHistoryId = response.headers.get('newHistoryId');
const newChatId = response.headers.get('newChatId');
const read = async () => {
try {
@@ -55,7 +55,7 @@ export const streamFetch = ({
return resolve({
responseText,
errMsg,
newHistoryId,
newChatId,
rawSearch
});
} else {
@@ -95,7 +95,7 @@ export const streamFetch = ({
return resolve({
responseText,
errMsg,
newHistoryId,
newChatId,
rawSearch
});
}

View File

@@ -13,7 +13,6 @@ export interface InitChatResponse {
intro: string;
canUse: boolean;
};
customTitle?: string;
title: string;
variables: Record<string, any>;
history: ChatItemType[];