mirror of
https://github.com/fawney19/Aether.git
synced 2026-01-10 03:32:26 +08:00
fix: 确保 CLI handler 的 streaming 状态更新时 provider 信息已设置
在 execute_with_fallback 返回后,显式设置 ctx 的 provider 信息, 与 chat_handler_base.py 的行为保持一致,避免 streaming 状态更新 时 provider 为空的问题。
This commit is contained in:
@@ -329,9 +329,9 @@ class CliMessageHandlerBase(BaseMessageHandler):
|
|||||||
stream_generator,
|
stream_generator,
|
||||||
provider_name,
|
provider_name,
|
||||||
attempt_id,
|
attempt_id,
|
||||||
_provider_id,
|
provider_id,
|
||||||
_endpoint_id,
|
endpoint_id,
|
||||||
_key_id,
|
key_id,
|
||||||
) = await self.orchestrator.execute_with_fallback(
|
) = await self.orchestrator.execute_with_fallback(
|
||||||
api_format=ctx.api_format,
|
api_format=ctx.api_format,
|
||||||
model_name=ctx.model,
|
model_name=ctx.model,
|
||||||
@@ -341,7 +341,17 @@ class CliMessageHandlerBase(BaseMessageHandler):
|
|||||||
is_stream=True,
|
is_stream=True,
|
||||||
capability_requirements=capability_requirements or None,
|
capability_requirements=capability_requirements or None,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# 更新上下文(确保 provider 信息已设置,用于 streaming 状态更新)
|
||||||
ctx.attempt_id = attempt_id
|
ctx.attempt_id = attempt_id
|
||||||
|
if not ctx.provider_name:
|
||||||
|
ctx.provider_name = provider_name
|
||||||
|
if not ctx.provider_id:
|
||||||
|
ctx.provider_id = provider_id
|
||||||
|
if not ctx.endpoint_id:
|
||||||
|
ctx.endpoint_id = endpoint_id
|
||||||
|
if not ctx.key_id:
|
||||||
|
ctx.key_id = key_id
|
||||||
|
|
||||||
# 创建后台任务记录统计
|
# 创建后台任务记录统计
|
||||||
background_tasks = BackgroundTasks()
|
background_tasks = BackgroundTasks()
|
||||||
|
|||||||
Reference in New Issue
Block a user