fix: remove parsing json error and trim llm answer
Signed-off-by: James <james@jan.ai>
This commit is contained in:
parent
a29847d1bc
commit
4017f0f22b
@ -108,7 +108,6 @@ async function handleRequest(env: Env, request: Request) {
|
|||||||
const content = obj.choices[0].delta.content;
|
const content = obj.choices[0].delta.content;
|
||||||
if (content) deltaText = deltaText.concat(content);
|
if (content) deltaText = deltaText.concat(content);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cachedChunk = "";
|
cachedChunk = "";
|
||||||
@ -118,7 +117,7 @@ async function handleRequest(env: Env, request: Request) {
|
|||||||
const variables = {
|
const variables = {
|
||||||
id: messageBody.id,
|
id: messageBody.id,
|
||||||
data: {
|
data: {
|
||||||
content: answer,
|
content: answer.trim(),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user