fix: Keep Composing appends continuation instead of replacing prompt
Two fixes: - Backend: MAESTRO_COMPLETE_PROMPT now instructs Gemini to output ONLY the continuation text, not a rewrite. No repeating user's words. - Frontend: complete mode appends result to existing prompt with smart separator logic (lowercase start = space, uppercase = period+space). generate mode still replaces the empty prompt as before.
This commit is contained in:
1 parent
da5e63817f
commit
050c104201
2 files changed
+34
-14
No files matched your search
@@ -188,10 +188,21 @@ export default function Generator({ onGenerate }: Props) {
|
||||
<MaestroButton
|
||||
prompt={prompt}
|
||||
onResult={(result, mode) => {
|
||||
setPrompt(result)
|
||||
if (mode === 'generate') {
|
||||
setError('')
|
||||
if (mode === 'complete') {
|
||||
// Append continuation to existing prompt
|
||||
setPrompt(prev => {
|
||||
const trimmed = prev.trimEnd()
|
||||
// If result starts lowercase, it flows from the input — just space
|
||||
// If result starts uppercase, treat as new sentence — period + space
|
||||
const startsLower = /^[a-z]/.test(result)
|
||||
const separator = startsLower ? ' ' : '. '
|
||||
return trimmed + separator + result
|
||||
})
|
||||
} else {
|
||||
// Generate mode: replace empty prompt
|
||||
setPrompt(result)
|
||||
}
|
||||
setError('')
|
||||
}}
|
||||
onError={(msg) => setError(msg)}
|
||||
/>
|
||||
@@ -214,9 +225,19 @@ export default function Generator({ onGenerate }: Props) {
|
||||
prompt={Object.values(structuredPrompt).filter(Boolean).join(' ')}
|
||||
structured={isPro}
|
||||
onResult={(result, mode) => {
|
||||
// Fallback: plain text mode for non-Pro, put result in 'additional'
|
||||
setStructuredPrompt(prev => ({ ...prev, additional: result }))
|
||||
if (mode === 'generate') setError('')
|
||||
if (mode === 'complete') {
|
||||
// Fallback: append to additional field
|
||||
setStructuredPrompt(prev => {
|
||||
const existing = prev.additional?.trim() || ''
|
||||
const startsLower = /^[a-z]/.test(result)
|
||||
const separator = startsLower ? ' ' : '. '
|
||||
return { ...prev, additional: existing + separator + result }
|
||||
})
|
||||
} else {
|
||||
// Generate: put in additional
|
||||
setStructuredPrompt(prev => ({ ...prev, additional: result }))
|
||||
}
|
||||
setError('')
|
||||
}}
|
||||
onStructuredResult={(fields, mode) => {
|
||||
// Structured mode: merge fields into structuredPrompt, preserving user edits
|
||||
|
||||
Reference in new issue
Block a user