mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-19 01:54:04 +00:00
* feat: think tag parse * remove some model config * feat: parse think tag test
This commit is contained in:
@@ -24,7 +24,11 @@ export type StreamResponseType = {
|
||||
[DispatchNodeResponseKeyEnum.nodeResponse]: ChatHistoryItemResType[];
|
||||
};
|
||||
type ResponseQueueItemType =
|
||||
| { event: SseResponseEventEnum.fastAnswer | SseResponseEventEnum.answer; text: string }
|
||||
| {
|
||||
event: SseResponseEventEnum.fastAnswer | SseResponseEventEnum.answer;
|
||||
text?: string;
|
||||
reasoningText?: string;
|
||||
}
|
||||
| { event: SseResponseEventEnum.interactive; [key: string]: any }
|
||||
| {
|
||||
event:
|
||||
@@ -79,7 +83,7 @@ export const streamFetch = ({
|
||||
if (abortCtrl.signal.aborted) {
|
||||
responseQueue.forEach((item) => {
|
||||
onMessage(item);
|
||||
if (isAnswerEvent(item.event)) {
|
||||
if (isAnswerEvent(item.event) && item.text) {
|
||||
responseText += item.text;
|
||||
}
|
||||
});
|
||||
@@ -91,7 +95,7 @@ export const streamFetch = ({
|
||||
for (let i = 0; i < fetchCount; i++) {
|
||||
const item = responseQueue[i];
|
||||
onMessage(item);
|
||||
if (isAnswerEvent(item.event)) {
|
||||
if (isAnswerEvent(item.event) && item.text) {
|
||||
responseText += item.text;
|
||||
}
|
||||
}
|
||||
@@ -180,7 +184,7 @@ export const streamFetch = ({
|
||||
// console.log(parseJson, event);
|
||||
if (event === SseResponseEventEnum.answer) {
|
||||
const reasoningText = parseJson.choices?.[0]?.delta?.reasoning_content || '';
|
||||
onMessage({
|
||||
pushDataToQueue({
|
||||
event,
|
||||
reasoningText
|
||||
});
|
||||
@@ -194,7 +198,7 @@ export const streamFetch = ({
|
||||
}
|
||||
} else if (event === SseResponseEventEnum.fastAnswer) {
|
||||
const reasoningText = parseJson.choices?.[0]?.delta?.reasoning_content || '';
|
||||
onMessage({
|
||||
pushDataToQueue({
|
||||
event,
|
||||
reasoningText
|
||||
});
|
||||
|
Reference in New Issue
Block a user