- Added a new task store in `src-react/stores/task.ts` to manage tasks and their statuses. - Implemented functions for creating, executing, and retrying tasks, along with handling task progress and completion. - Introduced persistence for tasks using IPC. - Created utility functions for normalizing room types and building subtasks. - Added a new CSS file for global styles in `src-react/styles.css`. - Created runtime types in `src-react/types/runtime.ts` and exported them. - Updated the main entry points for Vue and React applications to support dynamic framework loading. - Refactored chat model interfaces and utility functions into `src/shared/chat-model.ts`. - Updated TypeScript configuration to include paths for React components and types. - Enhanced Vite configuration to support both Vue and React frameworks.
67 lines
1.5 KiB
TypeScript
67 lines
1.5 KiB
TypeScript
import type { RawMessage } from '@shared/chat-model';
|
|
|
|
/// Gateway 向 Renderer 推送的事件类型
|
|
export type GatewayEvent =
|
|
| {
|
|
type: 'chat:delta';
|
|
sessionKey: string;
|
|
runId: string;
|
|
delta: string;
|
|
}
|
|
| {
|
|
type: 'chat:final';
|
|
sessionKey: string;
|
|
runId: string;
|
|
message: RawMessage;
|
|
}
|
|
| {
|
|
type: 'chat:error';
|
|
sessionKey: string;
|
|
runId: string;
|
|
error: string;
|
|
}
|
|
| {
|
|
type: 'chat:aborted';
|
|
sessionKey: string;
|
|
runId: string;
|
|
}
|
|
| {
|
|
type: 'gateway:status';
|
|
status: 'connected' | 'disconnected' | 'reconnecting';
|
|
};
|
|
|
|
/// Gateway RPC 方法参数映射
|
|
export interface GatewayRpcParams {
|
|
'chat.send': {
|
|
sessionKey: string;
|
|
message: RawMessage;
|
|
options?: {
|
|
providerAccountId?: string;
|
|
};
|
|
};
|
|
'chat.history': {
|
|
sessionKey: string;
|
|
limit?: number;
|
|
};
|
|
'chat.abort': {
|
|
sessionKey: string;
|
|
};
|
|
'session.list': Record<string, never>;
|
|
'session.delete': {
|
|
sessionKey: string;
|
|
};
|
|
'provider.list': Record<string, never>;
|
|
'provider.getDefault': Record<string, never>;
|
|
}
|
|
|
|
/// Gateway RPC 方法返回值映射
|
|
export interface GatewayRpcReturns {
|
|
'chat.send': { runId: string };
|
|
'chat.history': RawMessage[];
|
|
'chat.abort': void;
|
|
'session.list': string[];
|
|
'session.delete': { success: boolean };
|
|
'provider.list': { accounts: any[]; defaultAccountId: string | null };
|
|
'provider.getDefault': { accountId: string | null };
|
|
}
|