diff --git a/app/(admin)/settings/admin-settings-client.tsx b/app/(admin)/settings/admin-settings-client.tsx index 947226b7a..cf3497fea 100644 --- a/app/(admin)/settings/admin-settings-client.tsx +++ b/app/(admin)/settings/admin-settings-client.tsx @@ -94,6 +94,10 @@ import { normalizeCanvasSkillTags, type CanvasSkillTag, } from "@/lib/canvas-skill-tags"; +import { + CANVAS_SKILL_ICON_OPTIONS, + getCanvasSkillIconComponent, +} from "@/components/canvas/canvas-skill-icons"; const fetcher = (url: string) => fetch(url).then((res) => res.json()); const DEFAULT_RUNWARE_REALTIME_MODEL = "runware:101@1"; @@ -104,6 +108,8 @@ function createEmptyCanvasSkillTag(): CanvasSkillTag { id: `tag-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`, name: "", prompt: "", + placeholder: "", + iconName: "message-circle", iconUrl: "", }; } @@ -1081,7 +1087,7 @@ export function AdminSettingsClient() { const handleCanvasSkillTagChange = ( index: number, - field: "name" | "prompt" | "iconUrl", + field: "name" | "prompt" | "placeholder" | "iconName" | "iconUrl", value: string ) => { setCanvasSkillTags((prev) => @@ -5737,86 +5743,124 @@ export function AdminSettingsClient() { 画布对话快捷标签 - 每个标签支持「图标 + 标签名 + 预设提示词」。用户点击标签后,发送消息时会自动附带对应提示词。 + 每个标签支持「图标 + 标签名 + 输入框提示词 + 预设提示词」。用户点击标签后,输入框会显示对应灰色提示,发送时会自动附带对应预设提示词。 - {canvasSkillTags.map((tag, index) => ( -
-
- - handleCanvasSkillTagChange(index, "name", event.target.value) - } - placeholder={`标签名称 ${index + 1}`} - /> - -
-
-
- {tag.iconUrl ? ( - {tag.name - ) : ( - - )} -
-
+ {canvasSkillTags.map((tag, index) => { + const TagIcon = getCanvasSkillIconComponent(tag.iconName); + return ( +
+
- handleCanvasSkillTagChange(index, "iconUrl", event.target.value) + handleCanvasSkillTagChange(index, "name", event.target.value) } - placeholder="图标 URL(可选)" + placeholder={`标签名称 ${index + 1}`} /> - { - const file = event.target.files?.[0]; - if (file) { - void handleCanvasSkillTagIconUpload(index, file); - } - event.currentTarget.value = ""; - }} - />
+
+
+ {tag.iconUrl ? ( + {tag.name + ) : ( + + )} +
+
+ + + handleCanvasSkillTagChange(index, "iconUrl", event.target.value) + } + placeholder="图标 URL(可选)" + /> + + { + const file = event.target.files?.[0]; + if (file) { + void handleCanvasSkillTagIconUpload(index, file); + } + event.currentTarget.value = ""; + }} + /> +
+
+ + handleCanvasSkillTagChange(index, "placeholder", event.target.value) + } + placeholder="输入框灰色提示词(可选)" + /> +