fix: pass selected language to AI agent when generating flow scripts (#8680)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -227,6 +227,7 @@ class AIChatManager {
|
||||
pendingPrompt?: string,
|
||||
options?: {
|
||||
closeScriptSettings?: boolean
|
||||
lang?: ScriptLang | 'bunnative'
|
||||
}
|
||||
) {
|
||||
if (mode === AIMode.SCRIPT && !tryGetCurrentModel()) return
|
||||
@@ -235,7 +236,7 @@ class AIChatManager {
|
||||
if (mode === AIMode.SCRIPT) {
|
||||
const currentModel = getCurrentModel()
|
||||
const customPrompt = getCombinedCustomPrompt(mode)
|
||||
const lang = this.scriptEditorOptions?.lang ?? 'bun'
|
||||
const lang = options?.lang ?? this.scriptEditorOptions?.lang ?? 'bun'
|
||||
const context = this.contextManager.getSelectedContext()
|
||||
this.systemMessage = prepareScriptSystemMessage(currentModel, lang, {}, customPrompt)
|
||||
this.systemMessage.content = this.systemMessage.content
|
||||
@@ -445,10 +446,7 @@ class AIChatManager {
|
||||
if (!pendingPrompt) return undefined
|
||||
this.pendingPrompt = ''
|
||||
if (this.mode === AIMode.SCRIPT) {
|
||||
return prepareScriptUserMessage(
|
||||
pendingPrompt,
|
||||
this.contextManager.getSelectedContext()
|
||||
)
|
||||
return prepareScriptUserMessage(pendingPrompt, this.contextManager.getSelectedContext())
|
||||
} else if (this.mode === AIMode.FLOW) {
|
||||
return prepareFlowUserMessage(
|
||||
pendingPrompt,
|
||||
@@ -574,9 +572,9 @@ class AIChatManager {
|
||||
} = {}
|
||||
) => {
|
||||
if (options.mode) {
|
||||
this.changeMode(options.mode)
|
||||
this.changeMode(options.mode, undefined, { lang: options.lang })
|
||||
} else {
|
||||
this.changeMode(this.mode)
|
||||
this.changeMode(this.mode, undefined, { lang: options.lang })
|
||||
}
|
||||
if (options.instructions) {
|
||||
this.instructions = options.instructions
|
||||
|
||||
Reference in New Issue
Block a user