INNER CODE UNIT · Python
LLMConfig
simonlin1212/vibe-astock · vr/app.py:79
class LLMConfig(BaseModel):
provider: str = "" # cli-* = 订阅接入(调本机 CLI);其余 = API 接入
baseURL: str = "" # 订阅接入时留空
apiKey: str = "" # 订阅接入时留空
model: str
class ChatReq(BaseModel):
messages: list[dict]
context: str = ""
llm: LLMConfig
@app.post("/api/chat")
def chat(req: ChatReq):
"""系统 AI 对话,**流式** NDJSON(每行一个事件 {type: tool|delta|done|error})。
- API 接入:OpenAI 兼容 function-calling,边流答案边推工具调用事件。