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

@@ -1,5 +1,6 @@
import { apiFetch } from "@/core/api/fetch-client";
import { getBackendBaseURL } from "@/core/config";
import { OptType, writeYLog } from "@/core/log/y-log";
import type { Agent } from "@/core/agents";
import type { IntentSummary } from "./intent";
@@ -268,7 +269,15 @@ export async function listRecommendHistory(draftId: string): Promise<RecommendHi
throw new Error(`list recommend history failed (${res.status}): ${text}`);
}
const data = (await res.json()) as { history: ServerHistoryItem[] };
return (data.history ?? []).map(toHistoryItem);
const items = (data.history ?? []).map(toHistoryItem);
writeYLog({
optType: OptType.search,
optDetail: "B1-CM助手-席位推荐-查询历史",
url: `/api/roundtable-drafts/${draftId}/recommendations`,
reqParam: { draftId },
returnParam: { count: items.length },
});
return items;
}
/** Append one recommendation run to a draft's history. */
@@ -296,7 +305,15 @@ export async function saveRecommendHistory(
const text = await res.text().catch(() => "");
throw new Error(`save recommend history failed (${res.status}): ${text}`);
}
return toHistoryItem((await res.json()) as ServerHistoryItem);
const item = toHistoryItem((await res.json()) as ServerHistoryItem);
writeYLog({
optType: OptType.create,
optDetail: "B1-CM助手-席位推荐-保存历史",
url: `/api/roundtable-drafts/${draftId}/recommendations`,
reqParam: { draftId, status: payload.status, picks: payload.picks?.length ?? 0 },
returnParam: { id: item.id },
});
return item;
}
/**