支持ghcproxy

This commit is contained in:
yhydev
2026-01-12 14:12:15 +08:00
parent 03e216373f
commit 9b0c32b6f2
6 changed files with 302 additions and 4 deletions

View File

@@ -105,10 +105,12 @@ async def chat_completions(
# First, collect all chunks to detect if there are tool calls
async for chunk in stream_llm_api(messages_to_llm, settings, log_id):
logger.info(f"sse_result: {chunk}")
raw_chunks.append(chunk)
# Extract content from SSE chunks
parsed = _parse_sse_data(chunk)
if parsed and parsed.get("type") != "done":
logger.info(f"sse_result_data: {parsed}")
if parsed and ( parsed.get("type") != "done" or parsed.get("choices").get("finish_reason") == "stop" ):
choices = parsed.get("choices")
if choices and len(choices) > 0:
delta = choices[0].get("delta")