feat: set default lang to english; fix ext lang setting
This commit is contained in:
@@ -417,10 +417,8 @@ export class PageAgentCore extends EventTarget {
|
|||||||
return this.config.customSystemPrompt
|
return this.config.customSystemPrompt
|
||||||
}
|
}
|
||||||
|
|
||||||
let systemPrompt = SYSTEM_PROMPT
|
|
||||||
|
|
||||||
const targetLanguage = this.config.language === 'zh-CN' ? '中文' : 'English'
|
const targetLanguage = this.config.language === 'zh-CN' ? '中文' : 'English'
|
||||||
systemPrompt = systemPrompt.replace(
|
const systemPrompt = SYSTEM_PROMPT.replace(
|
||||||
/Default working language: \*\*.*?\*\*/,
|
/Default working language: \*\*.*?\*\*/,
|
||||||
`Default working language: **${targetLanguage}**`
|
`Default working language: **${targetLanguage}**`
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ You excel at following tasks:
|
|||||||
</intro>
|
</intro>
|
||||||
|
|
||||||
<language_settings>
|
<language_settings>
|
||||||
- Default working language: **中文**
|
- Default working language: **English**
|
||||||
- Use the language that user is using. Return in user's language.
|
- Use the language that user is using. Return in user's language.
|
||||||
</language_settings>
|
</language_settings>
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,18 @@ import { createTabTools } from './tabTools'
|
|||||||
*/
|
*/
|
||||||
export class MultiPageAgent extends PageAgentCore {
|
export class MultiPageAgent extends PageAgentCore {
|
||||||
constructor(config: Omit<PageAgentConfig, 'pageController'>) {
|
constructor(config: Omit<PageAgentConfig, 'pageController'>) {
|
||||||
|
// multi page controller
|
||||||
const tabsController = new TabsController()
|
const tabsController = new TabsController()
|
||||||
const pageController = new RemotePageController(tabsController)
|
const pageController = new RemotePageController(tabsController)
|
||||||
const customTools = createTabTools(tabsController)
|
const customTools = createTabTools(tabsController)
|
||||||
|
|
||||||
|
// system prompt
|
||||||
|
const targetLanguage = config.language === 'zh-CN' ? '中文' : 'English'
|
||||||
|
const systemPrompt = SYSTEM_PROMPT.replace(
|
||||||
|
/Default working language: \*\*.*?\*\*/,
|
||||||
|
`Default working language: **${targetLanguage}**`
|
||||||
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When the agent is in side-panel and user closed the side-panel.
|
* When the agent is in side-panel and user closed the side-panel.
|
||||||
* There is no chance for isAgentRunning to be set false.
|
* There is no chance for isAgentRunning to be set false.
|
||||||
@@ -29,7 +37,7 @@ export class MultiPageAgent extends PageAgentCore {
|
|||||||
...config,
|
...config,
|
||||||
pageController: pageController as any,
|
pageController: pageController as any,
|
||||||
customTools: customTools,
|
customTools: customTools,
|
||||||
customSystemPrompt: SYSTEM_PROMPT,
|
customSystemPrompt: systemPrompt,
|
||||||
|
|
||||||
onBeforeTask: async (agent) => {
|
onBeforeTask: async (agent) => {
|
||||||
await tabsController.init(agent.task)
|
await tabsController.init(agent.task)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ You excel at following tasks:
|
|||||||
</intro>
|
</intro>
|
||||||
|
|
||||||
<language_settings>
|
<language_settings>
|
||||||
- Default working language: **中文**
|
- Default working language: **English**
|
||||||
- Use the language that user is using. Return in user's language.
|
- Use the language that user is using. Return in user's language.
|
||||||
</language_settings>
|
</language_settings>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user