feat: add custom system prompt configuration

This commit is contained in:
Simon
2026-01-22 17:21:10 +08:00
parent 7a560341aa
commit efe1f33144
2 changed files with 10 additions and 0 deletions

View File

@@ -413,6 +413,10 @@ export class PageAgentCore extends EventTarget {
* Get system prompt, dynamically replace language settings based on configured language
*/
#getSystemPrompt(): string {
if (this.config.customSystemPrompt) {
return this.config.customSystemPrompt
}
let systemPrompt = SYSTEM_PROMPT
const targetLanguage = this.config.language === 'zh-CN' ? '中文' : 'English'

View File

@@ -141,6 +141,12 @@ export interface AgentConfig {
* }
*/
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