feat(y-log): 问答按 LLM 调用各记一条 + 全量补齐各 API 操作埋点

- 问答日志从「每轮 onFinish 一条」改为 useThreadStream onLangChainEvent
  监听 on_chat_model_end,每次大模型调用结束各上报一条(含子代理)
- 广覆盖各 API client 成功路径:查看(view)/查询(search)/新增(create)/
  编辑(edit)/删除(delete)/启停(enabled·disabled)/导入导出,补齐此前
  整模块零埋点与漏掉的单条详情 GET;跳过高频 typeahead/轮询/bootstrap

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
AdministratorandClaude Opus 4.8 committed 2026-06-23 20:42:54 +08:00
1 parent 320f2ef814
commit df9c59e21c
35 files changed
+1569 -224

No files matched your search

+17 -2
View File
@@ -119,7 +119,15 @@ export async function listAllAgentsAdmin(): Promise<Agent[]> {
export async function getAgent(id: string): Promise<Agent> {
const res = await apiFetch(`${getBackendBaseURL()}/api/agents/${id}`);
if (!res.ok) throw new Error(`Agent '${id}' not found`);
return res.json() as Promise<Agent>;
const agent = (await res.json()) as Agent;
writeYLog({
optType: OptType.view,
optDetail: "B1-CM助手-智能体-查看",
url: `/api/agents/${id}`,
reqParam: { id },
returnParam: agent,
});
return agent;
}
export async function createAgent(request: CreateAgentRequest): Promise<Agent> {
@@ -183,7 +191,14 @@ export async function deleteAgent(id: string): Promise<void> {
export async function getAgentSelector(): Promise<AgentSelectorResponse> {
const res = await apiFetch(`${getBackendBaseURL()}/api/agents/selector`);
if (!res.ok) throw new Error(`Failed to load agent selector: ${res.statusText}`);
return res.json() as Promise<AgentSelectorResponse>;
const selector = (await res.json()) as AgentSelectorResponse;
writeYLog({
optType: OptType.search,
optDetail: "B1-CM助手-智能体-选择器",
url: `/api/agents/selector`,
returnParam: selector,
});
return selector;
}
export async function favoriteAgent(id: string): Promise<void> {