feat: refactor HomePage to integrate agents store and update related components

feat: add runtime event handling for providers in ProvidersSection

feat: update routing to include Channels and Agents pages

feat: extend route types and navigation items for Channels and Agents

feat: implement agents store for managing agent data and interactions

fix: update chat store to utilize agents store for agent-related functionality

chore: export agents store from index

fix: enhance runtime types for better event handling

fix: update Vite config to handle dev server URL correctly
This commit is contained in:
duanshuwen
2026-04-18 14:56:32 +08:00
parent dfa4388087
commit ee72cf7261
52 changed files with 6626 additions and 189 deletions

View File

@@ -1,44 +1,26 @@
export const DEFAULT_AGENT_ID = 'main';
export const DEFAULT_MAIN_SESSION_SUFFIX = 'main';
export const DEFAULT_MODEL_ID = DEFAULT_AGENT_ID;
export interface AgentSummary {
id: string;
name: string;
isDefault: boolean;
providerAccountId: string | null;
modelRef: string | null;
modelDisplay: string;
mainSessionKey: string;
vendorId?: string | null;
source?: 'synthetic-main' | 'provider-account';
}
import {
DEFAULT_AGENT_ID,
DEFAULT_CHANNEL_ACCOUNT_ID,
DEFAULT_MAIN_SESSION_SUFFIX,
buildChannelAccountOwnerKey,
normalizeChannelAccountId,
normalizeChannelType,
parseChannelAccountOwnerKey,
resolveChannelAccountOwner,
type AgentSummary,
type AgentChannelBinding,
type AgentChannelBindingInput,
type AgentChannelUnbindingInput,
type AgentsSnapshot,
} from './agents';
export type ModelSummary = AgentSummary;
export const DEFAULT_MODEL_ID = DEFAULT_AGENT_ID;
export interface ModelsSnapshot {
export type ModelsSnapshot = AgentsSnapshot & {
models: ModelSummary[];
agents?: ModelSummary[];
defaultAgentId: string;
defaultProviderAccountId: string | null;
defaultModelRef: string | null;
mainSessionSuffix: string;
configuredChannelTypes: string[];
channelOwners: Record<string, string>;
channelAccountOwners: Record<string, string>;
}
export interface AgentsSnapshot {
agents: AgentSummary[];
models?: AgentSummary[];
defaultAgentId: string;
defaultProviderAccountId: string | null;
defaultModelRef: string | null;
mainSessionSuffix: string;
configuredChannelTypes: string[];
channelOwners: Record<string, string>;
channelAccountOwners: Record<string, string>;
}
};
export interface ParsedSessionKey {
sessionKey: string;
@@ -110,3 +92,22 @@ export function normalizeAgentSessionKey(sessionKey: string): string {
export const normalizeModelId = normalizeAgentId;
export const buildModelSessionKey = buildAgentSessionKey;
export const normalizeModelSessionKey = normalizeAgentSessionKey;
export {
DEFAULT_AGENT_ID,
DEFAULT_CHANNEL_ACCOUNT_ID,
DEFAULT_MAIN_SESSION_SUFFIX,
buildChannelAccountOwnerKey,
normalizeChannelAccountId,
normalizeChannelType,
parseChannelAccountOwnerKey,
resolveChannelAccountOwner,
};
export type {
AgentSummary,
AgentChannelBinding,
AgentChannelBindingInput,
AgentChannelUnbindingInput,
AgentsSnapshot,
};