- ① 后端删除 app/ai_provider/(38 文件,含 anthropic/openai 格式、billing、audio、embedding)、services/ai_provider_admin.py、core/config/model_config.py、tests/ai_provider/(21 文件) - ② 连带退役 application/agent/(旧 Agent 循环/steer/follow-up/确认注册表)、application/skill_executor.py、app/skills/(python skills 孤儿)、endpoints/audio.py、application/imports.py(ProviderManager 消费方);settings 端点收敛为生成偏好 - ③ runs.py 修剪:AgentRunRegistry/steer/follow-up/confirmations 端点退役,保留 list/get/events/cancel/stream;safety 确认改为直接落库裁决(pending→approved/denied) - ④ 前端删除:models 页、ModelGatewayView、gateway.ts、GatewayPanel(玄关)、ModelGatewayPanel/ModelStrategyForm、audio.ts/useVoiceInput、网关类型与 mock;设置页收敛为外观/语言/通知 - ⑤ 配置收敛:config/models|providers|pricing.example.yaml 归档 shenshi/config/;.env.example 删 provider keys/MODEL_ENDPOINT_POOL/MODEL_CONFIG_PATH,收敛 SHENSHI_* - ⑥ 验收:rg 审计灵台 Provider SDK import 与 ai_provider 引用归零;后端 528 passed(2 个预存失败经 HEAD 复跑验证与本手术无关)、前端 type-check+201 passed、神识 go vet+test、BFF 4 passed
88 lines
3.9 KiB
Python
88 lines
3.9 KiB
Python
"""运行时 API schema。"""
|
|
|
|
from typing import Any
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
|
|
class EventResponse(BaseModel):
|
|
model_config = ConfigDict(
|
|
json_schema_extra={
|
|
"examples": [
|
|
{
|
|
"event_id": "event_70d5ef8a4c5b44a893b4f83f933b78e9",
|
|
"run_id": "run_a2c8ecc73c0e4cc7bc2fafbaeada74e0",
|
|
"character_id": "character_ec83d55746c54e47ab6f98d683032626",
|
|
"type": "message.delta",
|
|
"sequence": 2,
|
|
"visibility": "public",
|
|
"payload": {
|
|
"message_id": "message_2f9b7bf7d3b84231b67b28bb39fbfa7a",
|
|
"delta": "你好,我是魂镜中的默认人物,",
|
|
"index": 0,
|
|
},
|
|
"created_at": "2026-06-19T09:10:52.676462Z",
|
|
}
|
|
]
|
|
}
|
|
)
|
|
|
|
event_id: str = Field(description="事件 ID,前缀为 event_。")
|
|
run_id: str = Field(description="所属运行 ID。")
|
|
character_id: str = Field(description="所属人物 ID。")
|
|
type: str = Field(description="事件类型,例如 run.started、message.delta、run.completed。")
|
|
sequence: int = Field(description="Run 内递增序号,用于 SSE 断点续传。")
|
|
visibility: str = Field(description="事件可见性:public / internal / audit。")
|
|
payload: dict[str, Any] = Field(
|
|
description="事件负载。message.delta 中包含 delta、index、message_id。"
|
|
)
|
|
created_at: str = Field(description="创建时间,UTC ISO 8601 字符串。")
|
|
trace_id: str | None = Field(
|
|
default=None, description="链路追踪 ID,可在司命台链路追踪页据此追溯。"
|
|
)
|
|
|
|
|
|
class RunResponse(BaseModel):
|
|
model_config = ConfigDict(
|
|
json_schema_extra={
|
|
"examples": [
|
|
{
|
|
"id": "run_a2c8ecc73c0e4cc7bc2fafbaeada74e0",
|
|
"character_id": "character_ec83d55746c54e47ab6f98d683032626",
|
|
"session_id": "session_2e7c3cbd4ef8472bab59718b7d012f80",
|
|
"status": "completed",
|
|
"goal": "回复用户消息",
|
|
"origin": "chat",
|
|
"model_hint": "deepseek-v4-flash",
|
|
"started_at": "2026-06-19T09:10:52.660153Z",
|
|
"completed_at": "2026-06-19T09:10:52.690000Z",
|
|
"error_code": None,
|
|
"error_message": None,
|
|
"created_at": "2026-06-19T09:10:52.660153Z",
|
|
"updated_at": "2026-06-19T09:10:52.690000Z",
|
|
}
|
|
]
|
|
}
|
|
)
|
|
|
|
id: str = Field(description="运行 ID,前缀为 run_。")
|
|
character_id: str | None = Field(
|
|
default=None, description="所属人物 ID;照心试演(kind=rehearsal)无正式人物。"
|
|
)
|
|
status: str = Field(
|
|
description="运行状态:queued / running / completed / failed / cancelled / interrupted。"
|
|
)
|
|
kind: str = Field(
|
|
default="foreground",
|
|
description="运行种类:foreground / background_task / awakening / rehearsal(契约词典 §8.2)。",
|
|
)
|
|
goal: str | None = Field(description="运行目标。")
|
|
origin: str = Field(description="运行来源,例如 chat。")
|
|
model_hint: str | None = Field(description="本次运行使用的逻辑模型名或能力槽位。")
|
|
started_at: str | None = Field(description="开始时间。")
|
|
completed_at: str | None = Field(description="完成时间。")
|
|
error_code: str | None = Field(description="失败错误码;成功时为空。")
|
|
error_message: str | None = Field(description="失败错误信息;成功时为空。")
|
|
created_at: str = Field(description="创建时间,UTC ISO 8601 字符串。")
|
|
updated_at: str = Field(description="更新时间,UTC ISO 8601 字符串。")
|