mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
Merge pull request #462 from RooVetGit/fix_language_selector
Fix language selector
This commit is contained in:
5
.changeset/cyan-camels-explode.md
Normal file
5
.changeset/cyan-camels-explode.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"roo-cline": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix bug where language selector wasn't working
|
||||||
@@ -809,7 +809,8 @@ export class Cline {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const { browserViewportSize, mode, customPrompts } = (await this.providerRef.deref()?.getState()) ?? {}
|
const { browserViewportSize, mode, customPrompts, preferredLanguage } =
|
||||||
|
(await this.providerRef.deref()?.getState()) ?? {}
|
||||||
const { customModes } = (await this.providerRef.deref()?.getState()) ?? {}
|
const { customModes } = (await this.providerRef.deref()?.getState()) ?? {}
|
||||||
const systemPrompt = await (async () => {
|
const systemPrompt = await (async () => {
|
||||||
const provider = this.providerRef.deref()
|
const provider = this.providerRef.deref()
|
||||||
@@ -826,6 +827,7 @@ export class Cline {
|
|||||||
mode,
|
mode,
|
||||||
customPrompts,
|
customPrompts,
|
||||||
customModes,
|
customModes,
|
||||||
|
preferredLanguage,
|
||||||
)
|
)
|
||||||
})()
|
})()
|
||||||
|
|
||||||
|
|||||||
28
src/core/prompts/__tests__/sections.test.ts
Normal file
28
src/core/prompts/__tests__/sections.test.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import { addCustomInstructions } from "../sections/custom-instructions"
|
||||||
|
|
||||||
|
describe("addCustomInstructions", () => {
|
||||||
|
test("adds preferred language to custom instructions", async () => {
|
||||||
|
const result = await addCustomInstructions(
|
||||||
|
"mode instructions",
|
||||||
|
"global instructions",
|
||||||
|
"/test/path",
|
||||||
|
"test-mode",
|
||||||
|
{ preferredLanguage: "French" },
|
||||||
|
)
|
||||||
|
|
||||||
|
expect(result).toContain("Language Preference:")
|
||||||
|
expect(result).toContain("You should always speak and think in the French language")
|
||||||
|
})
|
||||||
|
|
||||||
|
test("works without preferred language", async () => {
|
||||||
|
const result = await addCustomInstructions(
|
||||||
|
"mode instructions",
|
||||||
|
"global instructions",
|
||||||
|
"/test/path",
|
||||||
|
"test-mode",
|
||||||
|
)
|
||||||
|
|
||||||
|
expect(result).not.toContain("Language Preference:")
|
||||||
|
expect(result).not.toContain("You should always speak and think in")
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -37,6 +37,7 @@ async function generatePrompt(
|
|||||||
promptComponent?: PromptComponent,
|
promptComponent?: PromptComponent,
|
||||||
customModeConfigs?: ModeConfig[],
|
customModeConfigs?: ModeConfig[],
|
||||||
globalCustomInstructions?: string,
|
globalCustomInstructions?: string,
|
||||||
|
preferredLanguage?: string,
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
if (!context) {
|
if (!context) {
|
||||||
throw new Error("Extension context is required for generating system prompt")
|
throw new Error("Extension context is required for generating system prompt")
|
||||||
@@ -79,7 +80,7 @@ ${getSystemInfoSection(cwd, mode, customModeConfigs)}
|
|||||||
|
|
||||||
${getObjectiveSection()}
|
${getObjectiveSection()}
|
||||||
|
|
||||||
${await addCustomInstructions(modeConfig.customInstructions || "", globalCustomInstructions || "", cwd, mode, {})}`
|
${await addCustomInstructions(modeConfig.customInstructions || "", globalCustomInstructions || "", cwd, mode, { preferredLanguage })}`
|
||||||
|
|
||||||
return basePrompt
|
return basePrompt
|
||||||
}
|
}
|
||||||
@@ -95,6 +96,7 @@ export const SYSTEM_PROMPT = async (
|
|||||||
customPrompts?: CustomPrompts,
|
customPrompts?: CustomPrompts,
|
||||||
customModes?: ModeConfig[],
|
customModes?: ModeConfig[],
|
||||||
globalCustomInstructions?: string,
|
globalCustomInstructions?: string,
|
||||||
|
preferredLanguage?: string,
|
||||||
): Promise<string> => {
|
): Promise<string> => {
|
||||||
if (!context) {
|
if (!context) {
|
||||||
throw new Error("Extension context is required for generating system prompt")
|
throw new Error("Extension context is required for generating system prompt")
|
||||||
@@ -123,5 +125,6 @@ export const SYSTEM_PROMPT = async (
|
|||||||
promptComponent,
|
promptComponent,
|
||||||
customModes,
|
customModes,
|
||||||
globalCustomInstructions,
|
globalCustomInstructions,
|
||||||
|
preferredLanguage,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user