feat: include evidence boundaries in report export
This commit is contained in:
@@ -45,6 +45,7 @@ import {
|
||||
import { defaultGuidedJyotishTopics } from "@/lib/guided-jyotish-topics";
|
||||
import { keepFocusWithin } from "@/lib/focus-trap";
|
||||
import { chatMessageViews, type ChatMessage } from "@/lib/chat-message-view";
|
||||
import { consultationReportMarkdown } from "@/lib/consultation-report-export";
|
||||
import {
|
||||
OnboardingAuthenticationError,
|
||||
type OnboardingContent,
|
||||
@@ -1292,11 +1293,15 @@ export default function Home() {
|
||||
message_count: session.messages.length,
|
||||
messages: session.messages.map((message) => ({ role: message.role, text: message.text })),
|
||||
};
|
||||
const reportMarkdown = consultationReportMarkdown({ title: session.title, messages: session.messages });
|
||||
const transcript = [
|
||||
`Jyotisha 对话:${session.title}`,
|
||||
"",
|
||||
...session.messages.map((message) => `${message.role === "user" ? "我" : "Jyotisha"}:${message.text}`),
|
||||
"",
|
||||
"---- Markdown 报告 ----",
|
||||
reportMarkdown,
|
||||
"",
|
||||
"---- JSON 分享包 ----",
|
||||
JSON.stringify(sharePayload, null, 2),
|
||||
].join("\n");
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import type { ChatMessage } from "./chat-message-view";
|
||||
|
||||
export function consultationReportMarkdown(input: {
|
||||
title: string;
|
||||
messages: readonly ChatMessage[];
|
||||
}) {
|
||||
const latestAssistant = [...input.messages].reverse().find((message) => message.role === "assistant");
|
||||
const evidence = latestAssistant?.workflowReceipt;
|
||||
return [
|
||||
`# ${input.title}`,
|
||||
"",
|
||||
"## 最新回答",
|
||||
latestAssistant?.text || "暂无回答。",
|
||||
"",
|
||||
"## Claim boundary",
|
||||
`technique_truth: ${latestAssistant?.techniqueTruth || "unknown"}`,
|
||||
evidence ? `workflow_route: ${evidence.route}` : "workflow_route: unknown",
|
||||
evidence ? `workflow_status: ${evidence.status}` : "workflow_status: unknown",
|
||||
evidence ? `precise_timing: ${evidence.preciseTiming}` : "precise_timing: unknown",
|
||||
evidence ? `missing_layers: ${evidence.missingLayers.join(" / ") || "none"}` : "missing_layers: unknown",
|
||||
"",
|
||||
"## Boundary",
|
||||
"本报告保留证据边界;未闭环内容不得包装成确定预测。",
|
||||
].join("\n");
|
||||
}
|
||||
Reference in New Issue
Block a user