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

52
src/lib/channel-types.ts Normal file
View File

@@ -0,0 +1,52 @@
export type ChannelConnectionStatus = 'connected' | 'connecting' | 'disconnected' | 'error';
export interface ChannelAccountCatalogItem {
accountId: string;
name: string;
configured: boolean;
status: ChannelConnectionStatus;
lastError?: string;
isDefault: boolean;
agentId?: string;
bindingScope?: 'account' | 'channel';
channelUrl?: string;
}
export interface ChannelAccountCatalogGroup {
channelType: string;
channelLabel: string;
defaultAccountId: string;
status: ChannelConnectionStatus;
accounts: ChannelAccountCatalogItem[];
}
export interface ChannelAccountsCatalogResponse {
success?: boolean;
channels?: ChannelAccountCatalogGroup[];
}
export type ChannelTargetKind = 'name' | 'identifier' | 'webhook' | 'url';
export type ChannelTargetSource =
| 'channel-name'
| 'account-id'
| 'remote'
| 'query-param'
| 'hash-param'
| 'channel-url'
| 'fallback';
export interface ChannelTargetCatalogItem {
value: string;
label: string;
description?: string;
kind?: ChannelTargetKind;
source?: ChannelTargetSource;
channelType?: string;
accountId?: string;
}
export interface ChannelTargetsCatalogResponse {
success?: boolean;
targets?: ChannelTargetCatalogItem[];
}

View File

@@ -7,6 +7,18 @@ export interface CronJobDelivery {
accountId?: string;
}
export interface CronDeliveryChannelAccount {
accountId: string;
name: string;
isDefault: boolean;
}
export interface CronDeliveryChannelGroup {
channelType: string;
defaultAccountId: string;
accounts: CronDeliveryChannelAccount[];
}
export interface CronJobLastRun {
time: string;
success: boolean;
@@ -24,6 +36,7 @@ export interface CronJob {
name: string;
message: string;
schedule: string | CronSchedule;
agentId?: string;
delivery?: CronJobDelivery;
enabled: boolean;
createdAt: string;
@@ -36,6 +49,7 @@ export interface CronJobCreateInput {
name: string;
message: string;
schedule: string;
agentId?: string;
delivery?: CronJobDelivery;
enabled?: boolean;
}
@@ -44,6 +58,7 @@ export interface CronJobUpdateInput {
name?: string;
message?: string;
schedule?: string;
agentId?: string;
delivery?: CronJobDelivery;
enabled?: boolean;
}

14
src/lib/runtime-events.ts Normal file
View File

@@ -0,0 +1,14 @@
import type { GatewayEvent, RuntimeRefreshTopic } from '../types/runtime';
export type RuntimeChangedGatewayEvent = Extract<GatewayEvent, { type: 'runtime:changed' }>;
export function isRuntimeChangedGatewayEvent(event: GatewayEvent): event is RuntimeChangedGatewayEvent {
return event.type === 'runtime:changed';
}
export function runtimeEventHasTopic(
event: RuntimeChangedGatewayEvent,
...topics: RuntimeRefreshTopic[]
): boolean {
return topics.some((topic) => event.topics.includes(topic));
}