From dda131c5ea339a7f17caab4ac5a7decceb166336 Mon Sep 17 00:00:00 2001
From: MT-Mint <798521692@qq.com>
Date: Wed, 8 Apr 2026 16:11:17 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20suggest=E7=82=B9=E5=87=BB=E5=90=8E?=
=?UTF-8?q?=E6=8C=89skill=5Fid=E6=95=B0=E7=BB=84=E8=B0=83=E7=94=A8bootstra?=
=?UTF-8?q?pRemoteSkill=E9=94=81=E5=AE=9A=E6=8A=80=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/components/workspace/input-box.tsx | 37 +++++++++++++++++--
1 file changed, 34 insertions(+), 3 deletions(-)
diff --git a/frontend/src/components/workspace/input-box.tsx b/frontend/src/components/workspace/input-box.tsx
index 9c9d4566..f7cea6d6 100644
--- a/frontend/src/components/workspace/input-box.tsx
+++ b/frontend/src/components/workspace/input-box.tsx
@@ -62,6 +62,7 @@ import type {
} from "@/core/i18n/locales/types";
import { POST_MESSAGE_TYPES, sendToParent } from "@/core/iframe-messages";
import { useModels } from "@/core/models/hooks";
+import { bootstrapRemoteSkill } from "@/core/skills/api";
import type { AgentThreadContext } from "@/core/threads";
import { useIframeSkill } from "@/hooks/use-iframe-skill";
import { cn } from "@/lib/utils";
@@ -428,6 +429,7 @@ export function InputBox({
{showWelcomeStyle && !hasSubmitted && searchParams.get("mode") !== "skill" && (
)}
@@ -492,26 +494,31 @@ export function InputBox({
// SuggestionList 容器
function SuggestionListContainer({
+ threadId,
sendSelectSkill,
}: {
+ threadId: string;
sendSelectSkill: (selectedSkills: SelectedSkillPayloadItem[]) => void;
}) {
return (
-
+
);
}
// 快速选择skillbutton
function SuggestionList({
+ threadId,
sendSelectSkill,
}: {
+ threadId: string;
sendSelectSkill: (selectedSkills: SelectedSkillPayloadItem[]) => void;
}) {
const { t } = useI18n();
+ const searchParams = useSearchParams();
const { textInput } = usePromptInputController();
- const suggestions =t.inputBox.suggestions
+ const suggestions = t.inputBox.suggestions;
const promptSuggestions = suggestions.filter(
(
suggestion,
@@ -528,6 +535,28 @@ function SuggestionList({
suggestion: string;
},
) => {
+ const languageTypeRaw =
+ searchParams.get("languageType")?.trim() ??
+ searchParams.get("language_type")?.trim();
+ const languageType = languageTypeRaw ? Number(languageTypeRaw) : 0;
+ const bootstrapByIds = (ids: string[]) => {
+ const content_ids = Array.from(
+ new Set(
+ ids
+ .map((id) => Number(id))
+ .filter((id) => Number.isFinite(id) && id > 0),
+ ),
+ );
+ if (!threadId || content_ids.length === 0) return;
+ void bootstrapRemoteSkill({
+ thread_id: threadId,
+ content_ids,
+ language_type: languageType,
+ target_dir: "/mnt/user-data/uploads/skill",
+ clear_target: true,
+ });
+ };
+
// 优先从 children 中提取 skill_id 数组,转换为 selectedSkills 发送给宿主页
const childSkillIds = (suggestion.children ?? [])
.map((item) => String(item.id).trim())
@@ -539,6 +568,7 @@ function SuggestionList({
name: suggestion.suggestion,
})),
);
+ bootstrapByIds(childSkillIds);
return;
}
if (suggestion.skill_id && suggestion.skill_id.length > 0) {
@@ -548,6 +578,7 @@ function SuggestionList({
name: suggestion.suggestion,
})),
);
+ bootstrapByIds(suggestion.skill_id);
return;
}
// 原有逻辑
@@ -567,7 +598,7 @@ function SuggestionList({
}
}, 500);
},
- [textInput, sendSelectSkill],
+ [textInput, sendSelectSkill, threadId, searchParams],
);
return (