feat: add custom system prompt configuration
This commit is contained in:
@@ -413,6 +413,10 @@ export class PageAgentCore extends EventTarget {
|
|||||||
* Get system prompt, dynamically replace language settings based on configured language
|
* Get system prompt, dynamically replace language settings based on configured language
|
||||||
*/
|
*/
|
||||||
#getSystemPrompt(): string {
|
#getSystemPrompt(): string {
|
||||||
|
if (this.config.customSystemPrompt) {
|
||||||
|
return this.config.customSystemPrompt
|
||||||
|
}
|
||||||
|
|
||||||
let systemPrompt = SYSTEM_PROMPT
|
let systemPrompt = SYSTEM_PROMPT
|
||||||
|
|
||||||
const targetLanguage = this.config.language === 'zh-CN' ? '中文' : 'English'
|
const targetLanguage = this.config.language === 'zh-CN' ? '中文' : 'English'
|
||||||
|
|||||||
@@ -141,6 +141,12 @@ export interface AgentConfig {
|
|||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
transformPageContent?: (content: string) => Promise<string> | string
|
transformPageContent?: (content: string) => Promise<string> | string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Completely override the default system prompt.
|
||||||
|
* @experimental Use with caution - incorrect prompts may break agent behavior.
|
||||||
|
*/
|
||||||
|
customSystemPrompt?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export type PageAgentConfig = LLMConfig & AgentConfig & PageControllerConfig
|
export type PageAgentConfig = LLMConfig & AgentConfig & PageControllerConfig
|
||||||
|
|||||||
Reference in New Issue
Block a user