Skip to content

Commit 886288f

Browse files
committed
fix:整理代码
1 parent f9d1933 commit 886288f

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

src/apiTools.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ export async function handleSimulatedFunctionCalling(
191191
const tool = toolRegistry.get(toolCall.name);
192192
if (tool) {
193193
const result = await tool.function(toolCall.arguments);
194+
messages.push({
195+
role: "assistant",
196+
content: `<tool_call>${JSON.stringify(toolCall)}</tool_call>`
197+
});
194198
messages.push({
195199
role: "user",
196200
content: `<tool_result>{"id": "${toolCall.id}", "result": "${result}"}</tool_result>`,

src/deepseekApi.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ export async function processDeepSeekResponse(
129129
}
130130

131131
finishReason = chunk.choices[0]?.finish_reason || null;
132+
if (finishReason){
133+
break;
134+
}
132135
}
133136

134137
return { chunkResponse, finishReason };

src/resources/chatPanelScript.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,13 @@ async function renderMessage(role, content, index) {
163163
}
164164

165165
if (role === 'model') {
166-
targetDiv.innerHTML = marked.parse(targetDiv.dataset.markdownContent, {
166+
let markdownContent = targetDiv.dataset.markdownContent;
167+
168+
//if (markdownContent.includes('<think>') && !markdownContent.includes('</think>')){
169+
// markdownContent += "</think>";
170+
//}
171+
172+
targetDiv.innerHTML = marked.parse(markdownContent, {
167173
breaks: false,
168174
mangle: false,
169175
headerIds: false,

0 commit comments

Comments
 (0)