feat: update pages

This commit is contained in:
Simon
2025-10-21 22:02:51 +08:00
parent e81291f54b
commit 55a3ce16e5
3 changed files with 92 additions and 33 deletions

View File

@@ -21,7 +21,7 @@ export interface LLMConfig {
maxRetries?: number
}
export interface UIConfig {
export interface AgentConfig {
// theme?: 'light' | 'dark'
language?: SupportedLanguage
@@ -43,7 +43,7 @@ export interface UIConfig {
* }),
* execute: async function (this: PageAgent, input) {
* const answer = await do_some_thing(input.question)
* return `✅ Received user answer: ${answer}`
* return "✅ Received user answer: " + answer
* },
* })
* }
@@ -66,7 +66,7 @@ export interface UIConfig {
/**
* @note this hook can block the disposal process
* @note when dispose caused by page unload, `reason` will be 'PAGE_UNLOADING'. this method CANNOT block unloading. async operations may be cut.
* @note when dispose caused by page unload, reason will be 'PAGE_UNLOADING'. this method CANNOT block unloading. async operations may be cut.
*/
onDispose?: (this: PageAgent, reason?: string) => void
@@ -87,7 +87,7 @@ export interface UIConfig {
experimentalPreventNewPage?: boolean
}
export type PageAgentConfig = LLMConfig & DomConfig & UIConfig
export type PageAgentConfig = LLMConfig & AgentConfig & DomConfig
export function parseLLMConfig(config: LLMConfig): Required<LLMConfig> {
return {