Merge branch 'main' of https://github.com/justlovemaki/AIClient-2-API
This commit is contained in:
commit
2c758db714
2 changed files with 12 additions and 1 deletions
2
VERSION
2
VERSION
|
|
@ -1 +1 @@
|
||||||
2.8.8
|
2.8.9
|
||||||
|
|
|
||||||
|
|
@ -491,6 +491,17 @@ export async function handleStreamRequest(res, service, model, requestBody, from
|
||||||
responseClosed = true;
|
responseClosed = true;
|
||||||
} finally {
|
} finally {
|
||||||
if (!responseClosed) {
|
if (!responseClosed) {
|
||||||
|
// 根据客户端协议发送相应的流式结束标记
|
||||||
|
const clientProtocol = getProtocolPrefix(fromProvider);
|
||||||
|
if (clientProtocol === MODEL_PROTOCOL_PREFIX.OPENAI) {
|
||||||
|
res.write('data: [DONE]\n\n');
|
||||||
|
} else if (clientProtocol === MODEL_PROTOCOL_PREFIX.OPENAI_RESPONSES) {
|
||||||
|
res.write('event: done\n');
|
||||||
|
res.write('data: {}\n\n');
|
||||||
|
} else if (clientProtocol === MODEL_PROTOCOL_PREFIX.CLAUDE) {
|
||||||
|
res.write('event: message_stop\n');
|
||||||
|
res.write('data: {"type":"message_stop"}\n\n');
|
||||||
|
}
|
||||||
res.end();
|
res.end();
|
||||||
}
|
}
|
||||||
await logConversation('output', fullResponseText, PROMPT_LOG_MODE, PROMPT_LOG_FILENAME);
|
await logConversation('output', fullResponseText, PROMPT_LOG_MODE, PROMPT_LOG_FILENAME);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue