feat: includes history events in panel
This commit is contained in:
@@ -184,6 +184,7 @@ export class PageAgent extends EventTarget {
|
|||||||
*/
|
*/
|
||||||
pushObservation(content: string): void {
|
pushObservation(content: string): void {
|
||||||
this.history.push({ type: 'observation', content })
|
this.history.push({ type: 'observation', content })
|
||||||
|
this.panel.update({ type: 'observation', content })
|
||||||
}
|
}
|
||||||
|
|
||||||
async execute(task: string): Promise<ExecutionResult> {
|
async execute(task: string): Promise<ExecutionResult> {
|
||||||
|
|||||||
@@ -352,6 +352,11 @@
|
|||||||
background: linear-gradient(135deg, rgba(255, 214, 0, 0.1), rgba(255, 214, 0, 0.05));
|
background: linear-gradient(135deg, rgba(255, 214, 0, 0.1), rgba(255, 214, 0, 0.05));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.observation {
|
||||||
|
border-left-color: rgb(147, 51, 234);
|
||||||
|
background: linear-gradient(135deg, rgba(147, 51, 234, 0.1), rgba(147, 51, 234, 0.05));
|
||||||
|
}
|
||||||
|
|
||||||
/* 突出显示 done 成功结果 */
|
/* 突出显示 done 成功结果 */
|
||||||
&.doneSuccess {
|
&.doneSuccess {
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ export type PanelUpdate =
|
|||||||
| { type: 'completed' }
|
| { type: 'completed' }
|
||||||
| { type: 'toolExecuting'; toolName: string; args: any }
|
| { type: 'toolExecuting'; toolName: string; args: any }
|
||||||
| { type: 'toolCompleted'; toolName: string; args: any; result?: string; duration?: number }
|
| { type: 'toolCompleted'; toolName: string; args: any; result?: string; duration?: number }
|
||||||
|
| { type: 'observation'; content: string }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Agent control panel
|
* Agent control panel
|
||||||
@@ -196,6 +197,8 @@ export class Panel {
|
|||||||
duration: data.duration,
|
duration: data.duration,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case 'observation':
|
||||||
|
return { type: 'observation', displayText: data.content }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -581,7 +584,7 @@ export class Panel {
|
|||||||
typeClass = styles.error
|
typeClass = styles.error
|
||||||
statusIcon = '❌'
|
statusIcon = '❌'
|
||||||
} else if (step.type === 'tool_executing') {
|
} else if (step.type === 'tool_executing') {
|
||||||
statusIcon = '⚙️'
|
statusIcon = '🔨'
|
||||||
} else if (step.type === 'output') {
|
} else if (step.type === 'output') {
|
||||||
typeClass = styles.output
|
typeClass = styles.output
|
||||||
statusIcon = '🤖'
|
statusIcon = '🤖'
|
||||||
@@ -591,6 +594,9 @@ export class Panel {
|
|||||||
} else if (step.type === 'retry') {
|
} else if (step.type === 'retry') {
|
||||||
typeClass = styles.retry
|
typeClass = styles.retry
|
||||||
statusIcon = '🔄'
|
statusIcon = '🔄'
|
||||||
|
} else if (step.type === 'observation') {
|
||||||
|
typeClass = styles.observation
|
||||||
|
statusIcon = '👁️'
|
||||||
} else {
|
} else {
|
||||||
statusIcon = '🧠'
|
statusIcon = '🧠'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,15 @@ export interface Step {
|
|||||||
id: string
|
id: string
|
||||||
stepNumber: number
|
stepNumber: number
|
||||||
timestamp: Date
|
timestamp: Date
|
||||||
type: 'thinking' | 'tool_executing' | 'completed' | 'error' | 'output' | 'input' | 'retry'
|
type:
|
||||||
|
| 'thinking'
|
||||||
|
| 'tool_executing'
|
||||||
|
| 'completed'
|
||||||
|
| 'error'
|
||||||
|
| 'output'
|
||||||
|
| 'input'
|
||||||
|
| 'retry'
|
||||||
|
| 'observation'
|
||||||
|
|
||||||
// Tool execution related
|
// Tool execution related
|
||||||
toolName?: string
|
toolName?: string
|
||||||
|
|||||||
Reference in New Issue
Block a user