feat(kol): add selection-based AI optimize for prompt editor

Trigger an AI optimize panel from a text selection in the KOL prompt
editor, accept a user instruction, and stream a preview before replacing
the selected fragment. Extend the shared editor AI assist panel with
boundary-aware placement so it can be hosted inside scoped surfaces, and
update the backend optimize prompt to honor the user instruction.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-25 22:41:40 +08:00
parent 2862aff72b
commit 2846968cf7
9 changed files with 1428 additions and 112 deletions
+4 -1
View File
@@ -274,7 +274,10 @@ const enUS = {
preview: "Preview form",
aiGenerate: "AI Generate",
aiOptimize: "AI Optimize",
aiPlaceholder: "Describe the prompt effect you want, and AI will generate or optimize it...",
aiPlaceholder: "Describe the prompt effect you want, and AI will generate it...",
aiOptimizePromptPlaceholder: "For example: make this prompt clearer, keep variable placeholders, and reduce ambiguity.",
aiOptimizeDisclaimer: "AI output is for reference only. Review it before replacing the selected prompt text.",
aiOptimizeReplace: "Replace selection",
},
variable: {
input: "Input",
+4 -1
View File
@@ -274,7 +274,10 @@ const zhCN = {
preview: "预览表单",
aiGenerate: "AI 生成",
aiOptimize: "AI 优化",
aiPlaceholder: "描述你想要的 prompt 效果,AI 帮你生成 / 优化...",
aiPlaceholder: "描述你想要的 prompt 效果,AI 帮你生成...",
aiOptimizePromptPlaceholder: "例如:让这段提示词更清晰,保留变量占位符,减少歧义。",
aiOptimizeDisclaimer: "AI 生成内容仅供参考,请确认后再替换选中片段。",
aiOptimizeReplace: "替换选中内容",
},
variable: {
input: "输入框",