fix(ext): useAgent execute return result
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
import type {
|
import type {
|
||||||
AgentActivity,
|
AgentActivity,
|
||||||
AgentStatus,
|
AgentStatus,
|
||||||
|
ExecutionResult,
|
||||||
HistoricalEvent,
|
HistoricalEvent,
|
||||||
SupportedLanguage,
|
SupportedLanguage,
|
||||||
} from '@page-agent/core'
|
} from '@page-agent/core'
|
||||||
@@ -32,7 +33,7 @@ export interface UseAgentResult {
|
|||||||
activity: AgentActivity | null
|
activity: AgentActivity | null
|
||||||
currentTask: string
|
currentTask: string
|
||||||
config: ExtConfig | null
|
config: ExtConfig | null
|
||||||
execute: (task: string) => Promise<void>
|
execute: (task: string) => Promise<ExecutionResult>
|
||||||
stop: () => void
|
stop: () => void
|
||||||
configure: (config: ExtConfig) => Promise<void>
|
configure: (config: ExtConfig) => Promise<void>
|
||||||
}
|
}
|
||||||
@@ -110,7 +111,7 @@ export function useAgent(): UseAgentResult {
|
|||||||
|
|
||||||
setCurrentTask(task)
|
setCurrentTask(task)
|
||||||
setHistory([])
|
setHistory([])
|
||||||
await agent.execute(task)
|
return agent.execute(task)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const stop = useCallback(() => {
|
const stop = useCallback(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user