47 lines
1.7 KiB
TypeScript
47 lines
1.7 KiB
TypeScript
"use client";
|
|
|
|
import { useEffect, useState } from "react";
|
|
import { api } from "@/lib/api";
|
|
import type { CallableQAItem } from "@/lib/types";
|
|
|
|
export default function CallableQAPage() {
|
|
const [items, setItems] = useState<CallableQAItem[]>([]);
|
|
|
|
useEffect(() => {
|
|
api.get<CallableQAItem[]>("/standard-qa/callable").then(setItems);
|
|
}, []);
|
|
|
|
return (
|
|
<div className="space-y-6">
|
|
<div>
|
|
<h1 className="text-2xl font-semibold text-ink">智能体可调用库</h1>
|
|
</div>
|
|
<div className="grid gap-4">
|
|
{items.map((item) => (
|
|
<article key={item.id} className="rounded-md border border-line bg-white p-5">
|
|
<div className="mb-2 flex flex-wrap items-center gap-2 text-xs text-slate-500">
|
|
<span>{item.standard_code}</span>
|
|
<span>{item.primary_topic}</span>
|
|
<span>{item.course_stage}</span>
|
|
</div>
|
|
<h2 className="text-base font-semibold text-ink">{item.standard_question}</h2>
|
|
<p className="mt-3 whitespace-pre-wrap text-sm leading-6 text-slate-700">{item.standard_answer}</p>
|
|
<div className="mt-4 flex flex-wrap gap-2 text-xs">
|
|
{item.problem_tags.map((tag) => (
|
|
<span key={tag} className="rounded-md border border-line bg-panel px-2 py-1">
|
|
{tag}
|
|
</span>
|
|
))}
|
|
</div>
|
|
{item.answer_boundary ? <p className="mt-4 text-sm text-amber-800">{item.answer_boundary}</p> : null}
|
|
</article>
|
|
))}
|
|
{items.length === 0 ? (
|
|
<div className="rounded-md border border-line bg-white p-8 text-center text-sm text-slate-500">暂无可调用问答</div>
|
|
) : null}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|