feat(ui): add ButlerPanel — pain points, proposals, memory insights
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
- Add Butler types (PainPoint, Proposal, DelegationResult) to viking-client.ts - Add butler API functions: getButlerInsights, getButlerProposals, recordButlerPainPoint, generateButlerSolution, updateButlerProposalStatus, butlerDelegateTask - Create ButlerPanel with three sections: - InsightsSection: pain point cards with evidence chain, severity, confidence - ProposalsSection: solution cards with accept/reject actions - MemorySection: Viking memory entries per agent - Create useButlerInsights hook for data fetching - Add "管家" tab to RightPanel with ConciergeBell icon Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -201,9 +201,116 @@ export async function extractAndStoreMemories(
|
||||
});
|
||||
}
|
||||
|
||||
// === Butler Insights Functions ===
|
||||
|
||||
export interface ButlerPainPoint {
|
||||
id: string;
|
||||
agent_id: string;
|
||||
user_id: string;
|
||||
summary: string;
|
||||
category: string;
|
||||
severity: 'low' | 'medium' | 'high';
|
||||
evidence: Array<{ when: string; user_said: string; why_flagged: string }>;
|
||||
occurrence_count: number;
|
||||
first_seen: string;
|
||||
last_seen: string;
|
||||
confidence: number;
|
||||
status: 'detected' | 'confirmed' | 'solving' | 'solved' | 'dismissed';
|
||||
}
|
||||
|
||||
export interface ButlerProposalStep {
|
||||
index: number;
|
||||
action: string;
|
||||
detail: string;
|
||||
skill_hint: string | null;
|
||||
}
|
||||
|
||||
export interface ButlerProposal {
|
||||
id: string;
|
||||
pain_point_id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
steps: ButlerProposalStep[];
|
||||
status: 'pending' | 'accepted' | 'rejected' | 'completed';
|
||||
evidence_chain: Array<{ when: string; user_said: string; why_flagged: string }>;
|
||||
confidence_at_creation: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface ButlerDelegationTask {
|
||||
id: string;
|
||||
description: string;
|
||||
category: string;
|
||||
priority: number;
|
||||
status: 'pending' | 'assigned' | 'in_progress' | 'completed' | 'failed';
|
||||
assigned_expert: { id: string; name: string; role: string } | null;
|
||||
}
|
||||
|
||||
export interface ButlerDelegationResult {
|
||||
request: string;
|
||||
tasks: ButlerDelegationTask[];
|
||||
success: boolean;
|
||||
summary: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get butler insights data - pain points and proposals for the but agentId }
|
||||
* Get butler pain points for an agent
|
||||
*/
|
||||
export async function getButlerInsights(agentId: string): Promise<ButlerPainPoint[]> {
|
||||
return invoke<ButlerPainPoint[]>('butler_list_pain_points', { agentId });
|
||||
}
|
||||
|
||||
/**
|
||||
* Get butler proposals for an agent
|
||||
*/
|
||||
export async function getButlerProposals(agentId: string): Promise<ButlerProposal[]> {
|
||||
return invoke<ButlerProposal[]>('butler_list_proposals', { agentId });
|
||||
}
|
||||
|
||||
/**
|
||||
* Record a new pain point from conversation analysis
|
||||
*/
|
||||
export async function recordButlerPainPoint(
|
||||
agentId: string,
|
||||
userId: string,
|
||||
summary: string,
|
||||
category: string,
|
||||
severity: string,
|
||||
userSaid: string,
|
||||
whyFlagged: string
|
||||
): Promise<ButlerPainPoint> {
|
||||
return invoke<ButlerPainPoint>('butler_record_pain_point', {
|
||||
agentId,
|
||||
userId,
|
||||
summary,
|
||||
category,
|
||||
severity,
|
||||
userSaid,
|
||||
whyFlagged,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a solution for a high-confidence pain point
|
||||
*/
|
||||
export async function generateButlerSolution(painId: string): Promise<ButlerProposal> {
|
||||
return invoke<ButlerProposal>('butler_generate_solution', { painId });
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the status of a proposal
|
||||
*/
|
||||
export async function updateButlerProposalStatus(
|
||||
proposalId: string,
|
||||
status: string
|
||||
): Promise<void> {
|
||||
return invoke<void>('butler_update_proposal_status', { proposalId, status });
|
||||
}
|
||||
|
||||
/**
|
||||
* Butler delegates a user request to expert agents
|
||||
*/
|
||||
export async function butlerDelegateTask(request: string): Promise<ButlerDelegationResult> {
|
||||
return invoke<ButlerDelegationResult>('butler_delegate_task', { request });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user