Build lightweight AI agent admin

This commit is contained in:
Codex
2026-06-08 18:14:59 +08:00
commit e164840f43
2530 changed files with 435693 additions and 0 deletions
@@ -0,0 +1,48 @@
import type { TreeNodeType } from './types';
/**
* 数据库树节点图标配置
*/
import {
Database,
Eye,
Layers,
Table,
TableProperties,
} from '@vben/icons';
// 节点图标映射(connection 使用 assets/svg 中的数据库类型图标)
const iconMap: Record<TreeNodeType, any> = {
connection: Database,
database: Database,
schema: Layers,
'tables-folder': TableProperties,
'views-folder': Eye,
table: Table,
view: Eye,
};
// 节点图标样式映射
const iconClassMap: Record<TreeNodeType, string> = {
connection: '',
database: 'text-green-500',
schema: 'text-purple-500',
'tables-folder': 'text-orange-500',
'views-folder': 'text-cyan-500',
table: 'text-muted-foreground',
view: 'text-muted-foreground',
};
/**
* 获取节点图标组件
*/
export function getNodeIcon(type: string | TreeNodeType): any {
return iconMap[type as TreeNodeType] || Database;
}
/**
* 获取节点图标样式类
*/
export function getNodeIconClass(type: string | TreeNodeType): string {
return iconClassMap[type as TreeNodeType] || 'text-muted-foreground';
}
@@ -0,0 +1,8 @@
/**
* 数据库树公共工具
*/
export * from './icons';
export * from './types';
export { getDatabaseTypeIcon } from '#/assets/svg';
@@ -0,0 +1,53 @@
/**
* 数据库树节点类型定义
*/
// 节点类型
export type TreeNodeType =
| 'connection'
| 'database'
| 'schema'
| 'table'
| 'tables-folder'
| 'view'
| 'views-folder';
// 节点元数据
export interface TreeNodeMeta {
dbName?: string;
dbType?: string;
database?: string;
isSystem?: boolean;
schema?: string;
table?: string;
view?: string;
}
// 树节点
export interface TreeNode {
id: string;
label: string;
type: TreeNodeType;
isLeaf: boolean;
meta?: TreeNodeMeta;
children?: TreeNode[];
}
// 表字段信息
export interface TableField {
name: string;
type: string;
comment: string;
nullable: boolean;
isPrimaryKey: boolean;
}
// 右键菜单项
export interface ContextMenuItem {
label: string;
icon: any;
action: () => void;
divided?: boolean;
danger?: boolean;
disabled?: boolean;
}