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:
@@ -115,8 +115,13 @@ func BuildKolAssistUserPrompt(req AssistRequest) (string, error) {
|
||||
}
|
||||
schemaJSON = string(payload)
|
||||
}
|
||||
instruction := strings.TrimSpace(req.Description)
|
||||
if instruction == "" {
|
||||
instruction = "Make the prompt clearer, more complete, and easier for another AI to follow."
|
||||
}
|
||||
return fmt.Sprintf(
|
||||
"Optimize the following prompt. Keep variable placeholders intact. Current schema: %s\n\nPROMPT:\n%s",
|
||||
"Optimize the following prompt according to the instruction. Keep variable placeholders intact.\n\nInstruction:\n%s\n\nCurrent schema: %s\n\nPROMPT:\n%s",
|
||||
instruction,
|
||||
schemaJSON,
|
||||
req.CurrentContent,
|
||||
), nil
|
||||
|
||||
Reference in New Issue
Block a user