Merge pull request #35 from huangzhenhao90/fix/opencode-go-session-header

fix(ai): 修复 OpenCode Go 缺少会话 header 导致日报生成失败
This commit is contained in:
qingmao
2026-09-14 10:05:18 +08:00
committed by GitHub
5 changed files with 192 additions and 7 deletions
@@ -95,6 +95,7 @@ interface UseGroupReportGenerationArgs {
}
interface PreparedReportContext {
sessionId: string
input: Awaited<ReturnType<typeof buildGroupReportInput>>
startedAt: number
logs: ReportGenerationLog[]
@@ -507,6 +508,7 @@ export function useGroupReportGeneration({
const result = await trackStep(`AI 生成(${selectedModel.model})`, () =>
withTimeout(
window.api.aiChat(aiMessages, {
sessionId: context.sessionId,
providerId: selectedModel.providerId,
modelId: selectedModel.model,
timeoutMs: reportTimeoutSeconds * 1000
@@ -560,6 +562,7 @@ export function useGroupReportGeneration({
const repairResult = await trackStep(`AI 修复 JSON(${selectedModel.model})`, () =>
withTimeout(
window.api.aiChat(repairMessages, {
sessionId: context.sessionId,
providerId: selectedModel.providerId,
modelId: selectedModel.model,
timeoutMs: reportTimeoutSeconds * 1000
@@ -792,7 +795,12 @@ export function useGroupReportGeneration({
imageInsightsInjectedIntoPrompt:
input.imageInsightSummary.succeeded > 0 && input.prompt.includes('AI 图片识别摘要:')
})
const context: PreparedReportContext = { input, startedAt: startGenerateTime, logs }
const context: PreparedReportContext = {
sessionId: crypto.randomUUID(),
input,
startedAt: startGenerateTime,
logs
}
preparedContextRef.current = context
if (input.imageInsightSummary.failed > 0) {
setPreparationProgress({