Enhance AssistantConfig and pipeline for FastGPT integration

- Add new fields in AssistantConfig for FastGPT connection details, including `fastgpt_api_url`, `fastgpt_api_key`, and `fastgpt_app_id`.
- Update the pipeline to utilize the new FastGPT configuration, ensuring proper integration with external services.
- Introduce type handling for different assistant types, including support for realtime modes and external brain management.
- Refactor frontend components to include hints for FastGPT configuration inputs, improving user guidance during setup.
This commit is contained in:
Xin Wang
2026-06-16 16:55:51 +08:00
parent 43cc188d85
commit 809b634420
13 changed files with 415 additions and 18 deletions

View File

@@ -1419,18 +1419,27 @@ export function AssistantPage(props: AssistantPageProps) {
>
<InputField
label="App ID"
hint={
"FastGPT 应用的 appId用于拉取应用预设开场白等信息。\n在 FastGPT「应用详情 → 发布渠道 / API 访问」中获取。\n留空则不展示应用开场白回退使用本助手自身的开场白。"
}
value={fastGptForm.appId}
onChange={(value) => updateFastGptForm("appId", value)}
placeholder="请输入 FastGPT 应用 ID"
/>
<InputField
label="API URL"
hint={
"填 FastGPT 服务的主机根地址即可,例如 http://localhost:3000。\n系统会自动拼接 /api/v1/chat/completions无需手动带上该路径。\n即使粘贴了完整接口地址也会自动归一,但建议只填根地址。)"
}
value={fastGptForm.apiUrl}
onChange={(value) => updateFastGptForm("apiUrl", value)}
placeholder="https://api.fastgpt.in/api/v1/chat/completions"
placeholder="http://localhost:3000"
/>
<SecretInputField
label="API Key"
hint={
"FastGPT 为该应用生成的 API Key形如 fastgpt-xxxxx。\n在 FastGPT「应用详情 → API 访问」中创建。每个应用的 Key 独立。"
}
value={fastGptForm.apiKey}
onChange={(value) => updateFastGptForm("apiKey", value)}
placeholder="请输入 FastGPT API Key"
@@ -2529,12 +2538,14 @@ function SectionCard({
function InputField({
label,
hint,
value,
placeholder,
type = "text",
onChange,
}: {
label?: string;
hint?: string;
value: string;
placeholder?: string;
type?: string;
@@ -2543,7 +2554,10 @@ function InputField({
return (
<label className="block">
{label && (
<div className="mb-2 text-sm font-medium text-foreground">{label}</div>
<div className="mb-2 flex items-center gap-1.5 text-sm font-medium text-foreground">
<span>{label}</span>
{hint && <HelpHint text={hint} />}
</div>
)}
<Input
value={value}
@@ -2558,12 +2572,14 @@ function InputField({
function SecretInputField({
label,
hint,
value,
placeholder,
storedValueMask,
onChange,
}: {
label?: string;
hint?: string;
value: string;
placeholder?: string;
storedValueMask: string;
@@ -2575,7 +2591,10 @@ function SecretInputField({
return (
<label className="block">
{label && (
<div className="mb-2 text-sm font-medium text-foreground">{label}</div>
<div className="mb-2 flex items-center gap-1.5 text-sm font-medium text-foreground">
<span>{label}</span>
{hint && <HelpHint text={hint} />}
</div>
)}
{hasStoredValue && (
<div className="mb-2 flex items-center gap-2 text-xs text-muted-foreground">