2026-09-08 21:29:21 +08:00
|
|
|
import { Button } from "@douyinfe/semi-ui-19";
|
|
|
|
|
import type { ToolCardProps } from "../ai/types";
|
|
|
|
|
export function ResearchToolCard({ call, onAction }: ToolCardProps) {
|
|
|
|
|
const result = call.result || {};
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<p>
|
|
|
|
|
{typeof result.name === "string" ? result.name : "研究资料"}
|
|
|
|
|
{typeof result.version === "number" ? ` · v${result.version}` : ""}
|
|
|
|
|
</p>
|
2026-09-08 21:52:46 +08:00
|
|
|
{typeof result.id === "string" && !result.report && (
|
2026-09-08 21:29:21 +08:00
|
|
|
<Button
|
|
|
|
|
onClick={() =>
|
|
|
|
|
onAction(
|
|
|
|
|
result.content
|
|
|
|
|
? {
|
2026-09-08 21:52:46 +08:00
|
|
|
type:
|
|
|
|
|
result.kind === "feature"
|
|
|
|
|
? "open_feature"
|
|
|
|
|
: "open_template",
|
2026-09-08 21:29:21 +08:00
|
|
|
asset_id: result.id as string,
|
|
|
|
|
version: result.version as number,
|
|
|
|
|
nonce: Date.now(),
|
|
|
|
|
}
|
|
|
|
|
: {
|
|
|
|
|
type: "open_experiment",
|
|
|
|
|
experiment_id: result.id as string,
|
|
|
|
|
nonce: Date.now(),
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
打开研究记录
|
|
|
|
|
</Button>
|
|
|
|
|
)}
|
|
|
|
|
<details>
|
|
|
|
|
<summary>查看资料与校验依据</summary>
|
|
|
|
|
<pre>{JSON.stringify(result, null, 2)}</pre>
|
|
|
|
|
</details>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|