Skip to content

Commit ae41e36

Browse files
feat: lint
1 parent dfd4176 commit ae41e36

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

service/src/chatgpt/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,14 @@ search result: <search_result>${searchResultContent}</search_result>`,
241241
const responseChunk = {
242242
id: chunk.id,
243243
reasoning: responseReasoning, // 累积的推理内容
244-
text: responseText, // 累积的文本内容
244+
text: responseText, // 累积的文本内容
245245
role: 'assistant',
246246
finish_reason,
247247
// 增量数据,只包含本次新增的内容
248248
delta: {
249249
reasoning: reasoningContent, // 本次新增的推理内容
250-
text: content, // 本次新增的文本内容
251-
}
250+
text: content, // 本次新增的文本内容
251+
},
252252
}
253253

254254
// Call the process callback if provided

service/src/routes/chat.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -288,37 +288,38 @@ router.post('/chat-process', [auth, limiter], async (req, res) => {
288288
return
289289
}
290290
}
291-
291+
292292
message = regenerate ? await getChat(roomId, uuid) : await insertChat(uuid, prompt, uploadFileKeys, roomId, model, options as ChatOptions)
293-
293+
294294
result = await chatReplyProcess({
295295
message: prompt,
296296
uploadFileKeys,
297297
parentMessageId: options?.parentMessageId,
298298
process: (chunk: ResponseChunk) => {
299299
lastResponse = chunk
300-
300+
301301
// 根据数据类型发送不同的 SSE 事件
302302
if (chunk.searchQuery) {
303303
sendSSEData('search_query', { searchQuery: chunk.searchQuery })
304304
}
305305
if (chunk.searchResults) {
306-
sendSSEData('search_results', {
306+
sendSSEData('search_results', {
307307
searchResults: chunk.searchResults,
308-
searchUsageTime: chunk.searchUsageTime
308+
searchUsageTime: chunk.searchUsageTime,
309309
})
310310
}
311311
if (chunk.delta) {
312312
// 发送增量数据
313-
sendSSEData('delta', {m: chunk.delta})
314-
} else {
313+
sendSSEData('delta', { m: chunk.delta })
314+
}
315+
else {
315316
// 兼容现有格式,发送完整数据但标记为增量类型
316317
sendSSEData('message', {
317318
id: chunk.id,
318319
reasoning: chunk.reasoning,
319320
text: chunk.text,
320321
role: chunk.role,
321-
finish_reason: chunk.finish_reason
322+
finish_reason: chunk.finish_reason,
322323
})
323324
}
324325
},
@@ -330,12 +331,12 @@ router.post('/chat-process', [auth, limiter], async (req, res) => {
330331
room,
331332
chatUuid: uuid,
332333
})
333-
334+
334335
// 发送最终完成数据
335336
if (result && result.status === 'Success') {
336337
sendSSEData('complete', result.data)
337338
}
338-
339+
339340
sendSSEEnd()
340341
}
341342
catch (error) {

src/api/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export function fetchChatAPIProcessSSE(
9797
continue
9898

9999
if (line.startsWith('event: ')) {
100-
const _eventType = line.substring(7).trim()
100+
// const _eventType = line.substring(7).trim()
101101
continue
102102
}
103103

0 commit comments

Comments
 (0)