Release update (#1580)

* release doc

* fix: reg metch

* perf: tool call arg

* fix: stream update variables

* remove status

* update prompt

* rename embeddong model
This commit is contained in:
Archer
2024-05-24 11:07:03 +08:00
committed by GitHub
parent 92a3d6d268
commit 9c7c74050b
23 changed files with 119 additions and 93 deletions

View File

@@ -18,10 +18,9 @@ type StreamFetchProps = {
onMessage: StartChatFnProps['generatingMessage'];
abortCtrl: AbortController;
};
type StreamResponseType = {
export type StreamResponseType = {
responseText: string;
[DispatchNodeResponseKeyEnum.nodeResponse]: ChatHistoryItemResType[];
newVariables: Record<string, any>;
};
class FatalError extends Error {}
@@ -50,7 +49,6 @@ export const streamFetch = ({
)[] = [];
let errMsg: string | undefined;
let responseData: ChatHistoryItemResType[] = [];
let newVariables: Record<string, any> = {};
let finished = false;
const finish = () => {
@@ -58,7 +56,6 @@ export const streamFetch = ({
return failedFinish();
}
return resolve({
newVariables,
responseText,
responseData
});
@@ -71,7 +68,7 @@ export const streamFetch = ({
});
};
const isAnswerEvent = (event: `${SseResponseEventEnum}`) =>
const isAnswerEvent = (event: SseResponseEventEnum) =>
event === SseResponseEventEnum.answer || event === SseResponseEventEnum.fastAnswer;
// animate response to make it looks smooth
function animateResponseText() {
@@ -200,7 +197,10 @@ export const streamFetch = ({
} else if (event === SseResponseEventEnum.flowResponses && Array.isArray(parseJson)) {
responseData = parseJson;
} else if (event === SseResponseEventEnum.updateVariables) {
newVariables = parseJson;
onMessage({
event,
variables: parseJson
});
} else if (event === SseResponseEventEnum.error) {
if (parseJson.statusText === TeamErrEnum.aiPointsNotEnough) {
useSystemStore.getState().setIsNotSufficientModal(true);