@aix-chat/layouts 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,76 @@
1
+ import type { BasePanel, PanelProps } from '../panels/base';
2
+ import type { ChatCoreContainerConfig } from '../core';
3
+ type ChatCore = any;
4
+ /**
5
+ * 面板配置
6
+ */
7
+ export interface PanelConfig {
8
+ /** 面板实例 */
9
+ panel: BasePanel;
10
+ /** 面板配置 */
11
+ config?: any;
12
+ /** 面板宽度 */
13
+ width?: number;
14
+ /** 面板高度 */
15
+ height?: number;
16
+ /** 是否可折叠 */
17
+ collapsible?: boolean;
18
+ /** 默认折叠状态 */
19
+ defaultCollapsed?: boolean;
20
+ }
21
+ /**
22
+ * 布局编排器配置
23
+ */
24
+ export interface LayoutComposerConfig {
25
+ /** Chat 核心配置 */
26
+ chatConfig?: ChatCoreContainerConfig;
27
+ /** 左侧面板 */
28
+ leftPanel?: PanelConfig;
29
+ /** 右侧面板 */
30
+ rightPanel?: PanelConfig;
31
+ /** 顶部面板 */
32
+ topPanel?: PanelConfig;
33
+ /** 底部面板 */
34
+ bottomPanel?: PanelConfig;
35
+ }
36
+ /**
37
+ * 布局编排器属性
38
+ */
39
+ export interface LayoutComposerProps {
40
+ /** ChatCore 实例 */
41
+ core: ChatCore;
42
+ /** 配置 */
43
+ config?: LayoutComposerConfig;
44
+ }
45
+ /**
46
+ * 布局编排器
47
+ * 组合 Chat 核心 + 扩展面板
48
+ */
49
+ export interface LayoutComposer {
50
+ /** 类型 */
51
+ type: 'layout-composer';
52
+ /** 属性 */
53
+ props: LayoutComposerProps;
54
+ /** 渲染配置 */
55
+ renderConfig: {
56
+ core: ChatCore;
57
+ chatConfig?: ChatCoreContainerConfig;
58
+ left?: PanelProps & {
59
+ panel: BasePanel;
60
+ };
61
+ right?: PanelProps & {
62
+ panel: BasePanel;
63
+ };
64
+ top?: PanelProps & {
65
+ panel: BasePanel;
66
+ };
67
+ bottom?: PanelProps & {
68
+ panel: BasePanel;
69
+ };
70
+ };
71
+ }
72
+ /**
73
+ * 创建布局编排器
74
+ */
75
+ export declare function createLayoutComposer(core: ChatCore, config?: LayoutComposerConfig): LayoutComposer;
76
+ export default createLayoutComposer;
@@ -0,0 +1,92 @@
1
+ // TODO: ChatCore 类型不存在于 @aix-chat/core,需要重新设计
2
+ // import type { ChatCore } from '@aix-chat/core';
3
+
4
+ // 临时类型定义
5
+
6
+ /**
7
+ * 面板配置
8
+ */
9
+
10
+ /**
11
+ * 布局编排器配置
12
+ */
13
+
14
+ /**
15
+ * 布局编排器属性
16
+ */
17
+
18
+ /**
19
+ * 布局编排器
20
+ * 组合 Chat 核心 + 扩展面板
21
+ */
22
+
23
+ /**
24
+ * 创建布局编排器
25
+ */
26
+ export function createLayoutComposer(core, config) {
27
+ var _ref = config || {},
28
+ chatConfig = _ref.chatConfig,
29
+ leftPanel = _ref.leftPanel,
30
+ rightPanel = _ref.rightPanel,
31
+ topPanel = _ref.topPanel,
32
+ bottomPanel = _ref.bottomPanel;
33
+ var renderConfig = {
34
+ core: core,
35
+ chatConfig: chatConfig
36
+ };
37
+
38
+ // 构建面板渲染配置
39
+ if (leftPanel) {
40
+ renderConfig.left = {
41
+ core: core,
42
+ config: leftPanel.config,
43
+ position: 'left',
44
+ width: leftPanel.width,
45
+ collapsible: leftPanel.collapsible,
46
+ defaultCollapsed: leftPanel.defaultCollapsed,
47
+ panel: leftPanel.panel
48
+ };
49
+ }
50
+ if (rightPanel) {
51
+ renderConfig.right = {
52
+ core: core,
53
+ config: rightPanel.config,
54
+ position: 'right',
55
+ width: rightPanel.width,
56
+ collapsible: rightPanel.collapsible,
57
+ defaultCollapsed: rightPanel.defaultCollapsed,
58
+ panel: rightPanel.panel
59
+ };
60
+ }
61
+ if (topPanel) {
62
+ renderConfig.top = {
63
+ core: core,
64
+ config: topPanel.config,
65
+ position: 'top',
66
+ height: topPanel.height,
67
+ collapsible: topPanel.collapsible,
68
+ defaultCollapsed: topPanel.defaultCollapsed,
69
+ panel: topPanel.panel
70
+ };
71
+ }
72
+ if (bottomPanel) {
73
+ renderConfig.bottom = {
74
+ core: core,
75
+ config: bottomPanel.config,
76
+ position: 'bottom',
77
+ height: bottomPanel.height,
78
+ collapsible: bottomPanel.collapsible,
79
+ defaultCollapsed: bottomPanel.defaultCollapsed,
80
+ panel: bottomPanel.panel
81
+ };
82
+ }
83
+ return {
84
+ type: 'layout-composer',
85
+ props: {
86
+ core: core,
87
+ config: config
88
+ },
89
+ renderConfig: renderConfig
90
+ };
91
+ }
92
+ export default createLayoutComposer;
@@ -0,0 +1,2 @@
1
+ export { createLayoutComposer, type LayoutComposer, type LayoutComposerProps, type LayoutComposerConfig, type PanelConfig, } from './LayoutComposer';
2
+ export { default } from './LayoutComposer';
@@ -0,0 +1,2 @@
1
+ export { createLayoutComposer } from "./LayoutComposer";
2
+ export { default } from "./LayoutComposer";
@@ -0,0 +1,46 @@
1
+ type ChatCore = any;
2
+ type Message = any;
3
+ /**
4
+ * 消息渲染器
5
+ */
6
+ export interface MessageRenderer {
7
+ match: (message: Message) => boolean;
8
+ render: (message: Message) => any;
9
+ }
10
+ /**
11
+ * Chat 核心容器配置
12
+ */
13
+ export interface ChatCoreContainerConfig {
14
+ /** 是否显示头部 */
15
+ showHeader?: boolean;
16
+ /** 是否显示输入框 */
17
+ showInput?: boolean;
18
+ /** 消息渲染器 */
19
+ messageRenderers?: Record<string, MessageRenderer>;
20
+ /** 欢迎消息 */
21
+ welcomeMessage?: string;
22
+ }
23
+ /**
24
+ * Chat 核心容器属性
25
+ */
26
+ export interface ChatCoreContainerProps {
27
+ /** ChatCore 实例 */
28
+ core: ChatCore;
29
+ /** 配置 */
30
+ config?: ChatCoreContainerConfig;
31
+ }
32
+ /**
33
+ * Chat 核心容器
34
+ * 只包含消息列表和输入框,是所有布局的公共核心
35
+ */
36
+ export interface ChatCoreContainer {
37
+ /** 容器类型 */
38
+ type: 'chat-core';
39
+ /** 属性 */
40
+ props: ChatCoreContainerProps;
41
+ }
42
+ /**
43
+ * 创建 Chat 核心容器配置
44
+ */
45
+ export declare function createChatCoreContainer(core: ChatCore, config?: ChatCoreContainerConfig): ChatCoreContainer;
46
+ export default createChatCoreContainer;
@@ -0,0 +1,35 @@
1
+ // TODO: ChatCore, Message 类型不存在于 @aix-chat/core,需要重新设计
2
+ // import type { ChatCore, Message } from '@aix-chat/core';
3
+
4
+ // 临时类型定义
5
+
6
+ /**
7
+ * 消息渲染器
8
+ */
9
+
10
+ /**
11
+ * Chat 核心容器配置
12
+ */
13
+
14
+ /**
15
+ * Chat 核心容器属性
16
+ */
17
+
18
+ /**
19
+ * Chat 核心容器
20
+ * 只包含消息列表和输入框,是所有布局的公共核心
21
+ */
22
+
23
+ /**
24
+ * 创建 Chat 核心容器配置
25
+ */
26
+ export function createChatCoreContainer(core, config) {
27
+ return {
28
+ type: 'chat-core',
29
+ props: {
30
+ core: core,
31
+ config: config
32
+ }
33
+ };
34
+ }
35
+ export default createChatCoreContainer;
@@ -0,0 +1,2 @@
1
+ export { createChatCoreContainer, type ChatCoreContainer, type ChatCoreContainerProps, type ChatCoreContainerConfig, type MessageRenderer, } from './ChatCoreContainer';
2
+ export { default } from './ChatCoreContainer';
@@ -0,0 +1,2 @@
1
+ export { createChatCoreContainer } from "./ChatCoreContainer";
2
+ export { default } from "./ChatCoreContainer";
@@ -0,0 +1,3 @@
1
+ export { createChatCoreContainer, type ChatCoreContainer, type ChatCoreContainerProps, type ChatCoreContainerConfig, type MessageRenderer, } from './core';
2
+ export { BasePanel, type PanelProps, type PanelPosition, type PanelCapability, type PanelConfigSchema, ConversationPanel, type ConversationPanelConfig, SkillPanel, type SkillPanelConfig, DataPanel, type DataPanelConfig, type DataSourceType, SidePanel, type SidePanelConfig, createPanel, registerPanel, getAvailablePanels, hasPanel, type PanelMetadata, } from './panels';
3
+ export { createLayoutComposer, type LayoutComposer, type LayoutComposerProps, type LayoutComposerConfig, type PanelConfig, } from './composer';
package/dist/index.js ADDED
@@ -0,0 +1,14 @@
1
+ // 核心容器
2
+ export { createChatCoreContainer } from "./core";
3
+
4
+ // 面板系统
5
+ export {
6
+ // 基类
7
+ BasePanel,
8
+ // 具体面板
9
+ ConversationPanel, SkillPanel, DataPanel, SidePanel,
10
+ // 注册表
11
+ createPanel, registerPanel, getAvailablePanels, hasPanel } from "./panels";
12
+
13
+ // 布局编排器
14
+ export { createLayoutComposer } from "./composer";
@@ -0,0 +1,64 @@
1
+ type ChatCore = any;
2
+ /**
3
+ * 面板位置
4
+ */
5
+ export type PanelPosition = 'left' | 'right' | 'top' | 'bottom' | 'floating';
6
+ /**
7
+ * 面板能力
8
+ */
9
+ export interface PanelCapability {
10
+ name: string;
11
+ supported: boolean;
12
+ }
13
+ /**
14
+ * 面板配置 Schema
15
+ */
16
+ export interface PanelConfigSchema {
17
+ type: 'object';
18
+ properties?: Record<string, any>;
19
+ }
20
+ /**
21
+ * 面板属性
22
+ */
23
+ export interface PanelProps {
24
+ /** ChatCore 实例 */
25
+ core: ChatCore;
26
+ /** 面板配置 */
27
+ config?: any;
28
+ /** 面板位置 */
29
+ position: PanelPosition;
30
+ /** 面板宽度 */
31
+ width?: number;
32
+ /** 面板高度 */
33
+ height?: number;
34
+ /** 是否可折叠 */
35
+ collapsible?: boolean;
36
+ /** 默认折叠状态 */
37
+ defaultCollapsed?: boolean;
38
+ }
39
+ /**
40
+ * 面板基类
41
+ * 所有面板都必须继承此类
42
+ */
43
+ export declare abstract class BasePanel {
44
+ /** 面板唯一标识 */
45
+ abstract readonly id: string;
46
+ /** 面板显示名称 */
47
+ abstract readonly name: string;
48
+ /** 面板图标 */
49
+ abstract readonly icon?: string;
50
+ /**
51
+ * 渲染面板
52
+ * @param props 面板属性
53
+ */
54
+ abstract render(props: PanelProps): any;
55
+ /**
56
+ * 获取面板配置 Schema
57
+ */
58
+ getConfigSchema(): PanelConfigSchema;
59
+ /**
60
+ * 获取面板能力声明
61
+ */
62
+ getCapabilities(): PanelCapability[];
63
+ }
64
+ export default BasePanel;
@@ -0,0 +1,56 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ // TODO: ChatCore 类型不存在于 @aix-chat/core,需要重新设计
4
+ // import type { ChatCore } from '@aix-chat/core';
5
+
6
+ // 临时类型定义
7
+
8
+ /**
9
+ * 面板位置
10
+ */
11
+
12
+ /**
13
+ * 面板能力
14
+ */
15
+
16
+ /**
17
+ * 面板配置 Schema
18
+ */
19
+
20
+ /**
21
+ * 面板属性
22
+ */
23
+
24
+ /**
25
+ * 面板基类
26
+ * 所有面板都必须继承此类
27
+ */
28
+ export var BasePanel = /*#__PURE__*/function () {
29
+ function BasePanel() {
30
+ _classCallCheck(this, BasePanel);
31
+ }
32
+ _createClass(BasePanel, [{
33
+ key: "getConfigSchema",
34
+ value:
35
+ /**
36
+ * 获取面板配置 Schema
37
+ */
38
+ function getConfigSchema() {
39
+ return {
40
+ type: 'object',
41
+ properties: {}
42
+ };
43
+ }
44
+
45
+ /**
46
+ * 获取面板能力声明
47
+ */
48
+ }, {
49
+ key: "getCapabilities",
50
+ value: function getCapabilities() {
51
+ return [];
52
+ }
53
+ }]);
54
+ return BasePanel;
55
+ }();
56
+ export default BasePanel;
@@ -0,0 +1,2 @@
1
+ export { BasePanel, type PanelProps, type PanelPosition, type PanelCapability, type PanelConfigSchema, } from './BasePanel';
2
+ export { default } from './BasePanel';
@@ -0,0 +1,2 @@
1
+ export { BasePanel } from "./BasePanel";
2
+ export { default } from "./BasePanel";
@@ -0,0 +1,31 @@
1
+ import { BasePanel, type PanelProps, type PanelConfigSchema } from '../base';
2
+ /**
3
+ * 会话列表面板配置
4
+ */
5
+ export interface ConversationPanelConfig {
6
+ /** 是否显示头像 */
7
+ showAvatar?: boolean;
8
+ /** 标题最大长度 */
9
+ maxTitleLength?: number;
10
+ /** 允许删除 */
11
+ allowDelete?: boolean;
12
+ /** 允许重命名 */
13
+ allowRename?: boolean;
14
+ /** 展开状态 */
15
+ expand?: boolean;
16
+ }
17
+ /**
18
+ * 会话列表面板
19
+ */
20
+ export declare class ConversationPanel extends BasePanel {
21
+ readonly id = "conversation";
22
+ readonly name = "\u4F1A\u8BDD\u5217\u8868";
23
+ readonly icon = "MessageOutlined";
24
+ render(props: PanelProps): any;
25
+ getConfigSchema(): PanelConfigSchema;
26
+ getCapabilities(): {
27
+ name: string;
28
+ supported: boolean;
29
+ }[];
30
+ }
31
+ export default ConversationPanel;
@@ -0,0 +1,97 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
4
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
5
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
7
+ import { BasePanel } from "../base";
8
+
9
+ /**
10
+ * 会话列表面板配置
11
+ */
12
+
13
+ /**
14
+ * 会话列表面板
15
+ */
16
+ export var ConversationPanel = /*#__PURE__*/function (_BasePanel) {
17
+ _inherits(ConversationPanel, _BasePanel);
18
+ var _super = _createSuper(ConversationPanel);
19
+ function ConversationPanel() {
20
+ var _this;
21
+ _classCallCheck(this, ConversationPanel);
22
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
23
+ args[_key] = arguments[_key];
24
+ }
25
+ _this = _super.call.apply(_super, [this].concat(args));
26
+ _defineProperty(_assertThisInitialized(_this), "id", 'conversation');
27
+ _defineProperty(_assertThisInitialized(_this), "name", '会话列表');
28
+ _defineProperty(_assertThisInitialized(_this), "icon", 'MessageOutlined');
29
+ return _this;
30
+ }
31
+ _createClass(ConversationPanel, [{
32
+ key: "render",
33
+ value: function render(props) {
34
+ // 返回面板配置,实际渲染由 UI 层实现
35
+ return {
36
+ type: 'conversation',
37
+ props: props
38
+ };
39
+ }
40
+ }, {
41
+ key: "getConfigSchema",
42
+ value: function getConfigSchema() {
43
+ return {
44
+ type: 'object',
45
+ properties: {
46
+ showAvatar: {
47
+ type: 'boolean',
48
+ default: true,
49
+ description: '是否显示头像'
50
+ },
51
+ maxTitleLength: {
52
+ type: 'number',
53
+ default: 30,
54
+ description: '标题最大长度'
55
+ },
56
+ allowDelete: {
57
+ type: 'boolean',
58
+ default: true,
59
+ description: '允许删除会话'
60
+ },
61
+ allowRename: {
62
+ type: 'boolean',
63
+ default: true,
64
+ description: '允许重命名会话'
65
+ },
66
+ expand: {
67
+ type: 'boolean',
68
+ default: true,
69
+ description: '默认展开状态'
70
+ }
71
+ }
72
+ };
73
+ }
74
+ }, {
75
+ key: "getCapabilities",
76
+ value: function getCapabilities() {
77
+ return [{
78
+ name: 'createConversation',
79
+ supported: true
80
+ }, {
81
+ name: 'deleteConversation',
82
+ supported: true
83
+ }, {
84
+ name: 'renameConversation',
85
+ supported: true
86
+ }, {
87
+ name: 'switchConversation',
88
+ supported: true
89
+ }, {
90
+ name: 'searchConversation',
91
+ supported: false
92
+ }];
93
+ }
94
+ }]);
95
+ return ConversationPanel;
96
+ }(BasePanel);
97
+ export default ConversationPanel;
@@ -0,0 +1,2 @@
1
+ export { ConversationPanel, type ConversationPanelConfig, } from './ConversationPanel';
2
+ export { default } from './ConversationPanel';
@@ -0,0 +1,2 @@
1
+ export { ConversationPanel } from "./ConversationPanel";
2
+ export { default } from "./ConversationPanel";
@@ -0,0 +1,36 @@
1
+ import { BasePanel, type PanelProps, type PanelConfigSchema } from '../base';
2
+ /**
3
+ * 数据源类型
4
+ */
5
+ export type DataSourceType = 'api' | 'static' | 'custom';
6
+ /**
7
+ * 数据列表面板配置
8
+ */
9
+ export interface DataPanelConfig {
10
+ /** 面板标题 */
11
+ title?: string;
12
+ /** 数据源 */
13
+ dataSource?: {
14
+ type: DataSourceType;
15
+ config?: any;
16
+ };
17
+ /** 列表项渲染器 */
18
+ itemRenderer?: string;
19
+ /** 是否可多选 */
20
+ multiSelect?: boolean;
21
+ }
22
+ /**
23
+ * 数据列表面板
24
+ */
25
+ export declare class DataPanel extends BasePanel {
26
+ readonly id = "data";
27
+ readonly name = "\u6570\u636E\u5217\u8868";
28
+ readonly icon = "DatabaseOutlined";
29
+ render(props: PanelProps): any;
30
+ getConfigSchema(): PanelConfigSchema;
31
+ getCapabilities(): {
32
+ name: string;
33
+ supported: boolean;
34
+ }[];
35
+ }
36
+ export default DataPanel;
@@ -0,0 +1,97 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
4
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
5
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
7
+ import { BasePanel } from "../base";
8
+
9
+ /**
10
+ * 数据源类型
11
+ */
12
+
13
+ /**
14
+ * 数据列表面板配置
15
+ */
16
+
17
+ /**
18
+ * 数据列表面板
19
+ */
20
+ export var DataPanel = /*#__PURE__*/function (_BasePanel) {
21
+ _inherits(DataPanel, _BasePanel);
22
+ var _super = _createSuper(DataPanel);
23
+ function DataPanel() {
24
+ var _this;
25
+ _classCallCheck(this, DataPanel);
26
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
27
+ args[_key] = arguments[_key];
28
+ }
29
+ _this = _super.call.apply(_super, [this].concat(args));
30
+ _defineProperty(_assertThisInitialized(_this), "id", 'data');
31
+ _defineProperty(_assertThisInitialized(_this), "name", '数据列表');
32
+ _defineProperty(_assertThisInitialized(_this), "icon", 'DatabaseOutlined');
33
+ return _this;
34
+ }
35
+ _createClass(DataPanel, [{
36
+ key: "render",
37
+ value: function render(props) {
38
+ return {
39
+ type: 'data',
40
+ props: props
41
+ };
42
+ }
43
+ }, {
44
+ key: "getConfigSchema",
45
+ value: function getConfigSchema() {
46
+ return {
47
+ type: 'object',
48
+ properties: {
49
+ title: {
50
+ type: 'string',
51
+ default: '数据目录',
52
+ description: '面板标题'
53
+ },
54
+ dataSource: {
55
+ type: 'object',
56
+ properties: {
57
+ type: {
58
+ type: 'string',
59
+ enum: ['api', 'static', 'custom'],
60
+ description: '数据源类型'
61
+ },
62
+ config: {
63
+ type: 'object',
64
+ description: '数据源配置'
65
+ }
66
+ }
67
+ },
68
+ itemRenderer: {
69
+ type: 'string',
70
+ description: '列表项渲染器组件名称'
71
+ },
72
+ multiSelect: {
73
+ type: 'boolean',
74
+ default: false,
75
+ description: '是否可多选'
76
+ }
77
+ }
78
+ };
79
+ }
80
+ }, {
81
+ key: "getCapabilities",
82
+ value: function getCapabilities() {
83
+ return [{
84
+ name: 'selectData',
85
+ supported: true
86
+ }, {
87
+ name: 'multiSelect',
88
+ supported: true
89
+ }, {
90
+ name: 'searchData',
91
+ supported: false
92
+ }];
93
+ }
94
+ }]);
95
+ return DataPanel;
96
+ }(BasePanel);
97
+ export default DataPanel;
@@ -0,0 +1,2 @@
1
+ export { DataPanel, type DataPanelConfig, type DataSourceType } from './DataPanel';
2
+ export { default } from './DataPanel';
@@ -0,0 +1,2 @@
1
+ export { DataPanel } from "./DataPanel";
2
+ export { default } from "./DataPanel";
@@ -0,0 +1,32 @@
1
+ export { BasePanel, type PanelProps, type PanelPosition, type PanelCapability, type PanelConfigSchema, } from './base';
2
+ export { ConversationPanel, type ConversationPanelConfig } from './conversation';
3
+ export { SkillPanel, type SkillPanelConfig } from './skill';
4
+ export { DataPanel, type DataPanelConfig, type DataSourceType } from './data';
5
+ export { SidePanel, type SidePanelConfig } from './side';
6
+ import type { BasePanel } from './base';
7
+ /**
8
+ * 面板元数据
9
+ */
10
+ export interface PanelMetadata {
11
+ id: string;
12
+ name: string;
13
+ icon?: string;
14
+ configSchema: any;
15
+ capabilities: any[];
16
+ }
17
+ /**
18
+ * 注册面板
19
+ */
20
+ export declare function registerPanel(id: string, PanelClass: new () => BasePanel): void;
21
+ /**
22
+ * 创建面板实例
23
+ */
24
+ export declare function createPanel(id: string): BasePanel;
25
+ /**
26
+ * 获取所有可用面板
27
+ */
28
+ export declare function getAvailablePanels(): PanelMetadata[];
29
+ /**
30
+ * 检查面板是否已注册
31
+ */
32
+ export declare function hasPanel(id: string): boolean;
@@ -0,0 +1,72 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ // 面板基类
3
+ export { BasePanel } from "./base";
4
+
5
+ // 具体面板
6
+ export { ConversationPanel } from "./conversation";
7
+ export { SkillPanel } from "./skill";
8
+ export { DataPanel } from "./data";
9
+ export { SidePanel } from "./side";
10
+ import { ConversationPanel } from "./conversation";
11
+ import { SkillPanel } from "./skill";
12
+ import { DataPanel } from "./data";
13
+ import { SidePanel } from "./side";
14
+
15
+ /**
16
+ * 面板元数据
17
+ */
18
+
19
+ /**
20
+ * 面板注册表
21
+ */
22
+ var panelRegistry = new Map();
23
+
24
+ /**
25
+ * 注册面板
26
+ */
27
+ export function registerPanel(id, PanelClass) {
28
+ panelRegistry.set(id, PanelClass);
29
+ }
30
+
31
+ /**
32
+ * 创建面板实例
33
+ */
34
+ export function createPanel(id) {
35
+ var PanelClass = panelRegistry.get(id);
36
+ if (!PanelClass) {
37
+ throw new Error("Panel \"".concat(id, "\" not found in registry"));
38
+ }
39
+ return new PanelClass();
40
+ }
41
+
42
+ /**
43
+ * 获取所有可用面板
44
+ */
45
+ export function getAvailablePanels() {
46
+ return Array.from(panelRegistry.entries()).map(function (_ref) {
47
+ var _ref2 = _slicedToArray(_ref, 2),
48
+ id = _ref2[0],
49
+ PanelClass = _ref2[1];
50
+ var instance = new PanelClass();
51
+ return {
52
+ id: id,
53
+ name: instance.name,
54
+ icon: instance.icon,
55
+ configSchema: instance.getConfigSchema(),
56
+ capabilities: instance.getCapabilities()
57
+ };
58
+ });
59
+ }
60
+
61
+ /**
62
+ * 检查面板是否已注册
63
+ */
64
+ export function hasPanel(id) {
65
+ return panelRegistry.has(id);
66
+ }
67
+
68
+ // 注册内置面板
69
+ registerPanel('conversation', ConversationPanel);
70
+ registerPanel('skill', SkillPanel);
71
+ registerPanel('data', DataPanel);
72
+ registerPanel('side', SidePanel);
@@ -0,0 +1,28 @@
1
+ import { BasePanel, type PanelProps, type PanelConfigSchema } from '../base';
2
+ /**
3
+ * 副屏面板配置
4
+ */
5
+ export interface SidePanelConfig {
6
+ /** 默认展开 */
7
+ defaultOpen?: boolean;
8
+ /** 可渲染的组件列表 */
9
+ components?: string[];
10
+ /** 标题 */
11
+ title?: string;
12
+ }
13
+ /**
14
+ * 副屏面板
15
+ * 用于显示动态内容、插件扩展等
16
+ */
17
+ export declare class SidePanel extends BasePanel {
18
+ readonly id = "side";
19
+ readonly name = "\u526F\u5C4F";
20
+ readonly icon = "LayoutOutlined";
21
+ render(props: PanelProps): any;
22
+ getConfigSchema(): PanelConfigSchema;
23
+ getCapabilities(): {
24
+ name: string;
25
+ supported: boolean;
26
+ }[];
27
+ }
28
+ export default SidePanel;
@@ -0,0 +1,79 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
4
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
5
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
7
+ import { BasePanel } from "../base";
8
+
9
+ /**
10
+ * 副屏面板配置
11
+ */
12
+
13
+ /**
14
+ * 副屏面板
15
+ * 用于显示动态内容、插件扩展等
16
+ */
17
+ export var SidePanel = /*#__PURE__*/function (_BasePanel) {
18
+ _inherits(SidePanel, _BasePanel);
19
+ var _super = _createSuper(SidePanel);
20
+ function SidePanel() {
21
+ var _this;
22
+ _classCallCheck(this, SidePanel);
23
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
24
+ args[_key] = arguments[_key];
25
+ }
26
+ _this = _super.call.apply(_super, [this].concat(args));
27
+ _defineProperty(_assertThisInitialized(_this), "id", 'side');
28
+ _defineProperty(_assertThisInitialized(_this), "name", '副屏');
29
+ _defineProperty(_assertThisInitialized(_this), "icon", 'LayoutOutlined');
30
+ return _this;
31
+ }
32
+ _createClass(SidePanel, [{
33
+ key: "render",
34
+ value: function render(props) {
35
+ return {
36
+ type: 'side',
37
+ props: props
38
+ };
39
+ }
40
+ }, {
41
+ key: "getConfigSchema",
42
+ value: function getConfigSchema() {
43
+ return {
44
+ type: 'object',
45
+ properties: {
46
+ defaultOpen: {
47
+ type: 'boolean',
48
+ default: false,
49
+ description: '默认展开状态'
50
+ },
51
+ components: {
52
+ type: 'array',
53
+ items: {
54
+ type: 'string'
55
+ },
56
+ description: '可渲染的组件列表'
57
+ },
58
+ title: {
59
+ type: 'string',
60
+ description: '面板标题'
61
+ }
62
+ }
63
+ };
64
+ }
65
+ }, {
66
+ key: "getCapabilities",
67
+ value: function getCapabilities() {
68
+ return [{
69
+ name: 'dynamicContent',
70
+ supported: true
71
+ }, {
72
+ name: 'pluginExtension',
73
+ supported: true
74
+ }];
75
+ }
76
+ }]);
77
+ return SidePanel;
78
+ }(BasePanel);
79
+ export default SidePanel;
@@ -0,0 +1,2 @@
1
+ export { SidePanel, type SidePanelConfig } from './SidePanel';
2
+ export { default } from './SidePanel';
@@ -0,0 +1,2 @@
1
+ export { SidePanel } from "./SidePanel";
2
+ export { default } from "./SidePanel";
@@ -0,0 +1,27 @@
1
+ import { BasePanel, type PanelProps, type PanelConfigSchema } from '../base';
2
+ /**
3
+ * 技能列表面板配置
4
+ */
5
+ export interface SkillPanelConfig {
6
+ /** 技能分组字段 */
7
+ groupBy?: string;
8
+ /** 技能 ID 列表(过滤) */
9
+ skills?: string[];
10
+ /** 显示描述 */
11
+ showDescription?: boolean;
12
+ }
13
+ /**
14
+ * 技能列表面板
15
+ */
16
+ export declare class SkillPanel extends BasePanel {
17
+ readonly id = "skill";
18
+ readonly name = "\u6280\u80FD\u5217\u8868";
19
+ readonly icon = "AppstoreOutlined";
20
+ render(props: PanelProps): any;
21
+ getConfigSchema(): PanelConfigSchema;
22
+ getCapabilities(): {
23
+ name: string;
24
+ supported: boolean;
25
+ }[];
26
+ }
27
+ export default SkillPanel;
@@ -0,0 +1,78 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
4
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
5
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
7
+ import { BasePanel } from "../base";
8
+
9
+ /**
10
+ * 技能列表面板配置
11
+ */
12
+
13
+ /**
14
+ * 技能列表面板
15
+ */
16
+ export var SkillPanel = /*#__PURE__*/function (_BasePanel) {
17
+ _inherits(SkillPanel, _BasePanel);
18
+ var _super = _createSuper(SkillPanel);
19
+ function SkillPanel() {
20
+ var _this;
21
+ _classCallCheck(this, SkillPanel);
22
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
23
+ args[_key] = arguments[_key];
24
+ }
25
+ _this = _super.call.apply(_super, [this].concat(args));
26
+ _defineProperty(_assertThisInitialized(_this), "id", 'skill');
27
+ _defineProperty(_assertThisInitialized(_this), "name", '技能列表');
28
+ _defineProperty(_assertThisInitialized(_this), "icon", 'AppstoreOutlined');
29
+ return _this;
30
+ }
31
+ _createClass(SkillPanel, [{
32
+ key: "render",
33
+ value: function render(props) {
34
+ return {
35
+ type: 'skill',
36
+ props: props
37
+ };
38
+ }
39
+ }, {
40
+ key: "getConfigSchema",
41
+ value: function getConfigSchema() {
42
+ return {
43
+ type: 'object',
44
+ properties: {
45
+ groupBy: {
46
+ type: 'string',
47
+ description: '技能分组字段'
48
+ },
49
+ skills: {
50
+ type: 'array',
51
+ items: {
52
+ type: 'string'
53
+ },
54
+ description: '技能 ID 列表(过滤)'
55
+ },
56
+ showDescription: {
57
+ type: 'boolean',
58
+ default: true,
59
+ description: '显示技能描述'
60
+ }
61
+ }
62
+ };
63
+ }
64
+ }, {
65
+ key: "getCapabilities",
66
+ value: function getCapabilities() {
67
+ return [{
68
+ name: 'executeSkill',
69
+ supported: true
70
+ }, {
71
+ name: 'skillGroup',
72
+ supported: true
73
+ }];
74
+ }
75
+ }]);
76
+ return SkillPanel;
77
+ }(BasePanel);
78
+ export default SkillPanel;
@@ -0,0 +1,2 @@
1
+ export { SkillPanel, type SkillPanelConfig } from './SkillPanel';
2
+ export { default } from './SkillPanel';
@@ -0,0 +1,2 @@
1
+ export { SkillPanel } from "./SkillPanel";
2
+ export { default } from "./SkillPanel";
package/package.json ADDED
@@ -0,0 +1,86 @@
1
+ {
2
+ "name": "@aix-chat/layouts",
3
+ "version": "0.1.0",
4
+ "description": "AI Chat layouts",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/aix-chat/aix-chat"
8
+ },
9
+ "author": "yubai.zly",
10
+ "module": "dist/index.js",
11
+ "typings": "dist/index.d.ts",
12
+ "files": [
13
+ "dist"
14
+ ],
15
+ "scripts": {
16
+ "build": "father build",
17
+ "build:watch": "father build -w",
18
+ "ci": "npm run lint && jest --coverage --passWithNoTests",
19
+ "cov": "jest --coverage",
20
+ "dev": "dumi dev",
21
+ "lint": "eslint src --ext .ts,.tsx",
22
+ "start": "npm run dev",
23
+ "test": "jest",
24
+ "typecheck": "tsc --noEmit"
25
+ },
26
+ "commitlint": {
27
+ "extends": [
28
+ "@commitlint/config-conventional"
29
+ ]
30
+ },
31
+ "lint-staged": {
32
+ "*.{md,json}": [
33
+ "prettier --cache --write --no-error-on-unmatched-pattern"
34
+ ],
35
+ "*.{js,jsx}": [
36
+ "eslint --fix",
37
+ "prettier --cache --write"
38
+ ],
39
+ "*.{css,less}": [
40
+ "prettier --cache --write"
41
+ ],
42
+ "*.{ts,tsx}": [
43
+ "eslint --fix",
44
+ "prettier --cache --parser=typescript --write"
45
+ ]
46
+ },
47
+ "dependencies": {
48
+ "@aix-chat/adapters": "^0.1.0",
49
+ "@aix-chat/core": "^0.1.0",
50
+ "@aix-chat/utils": "^0.1.0",
51
+ "@babel/runtime": "^7.18.0",
52
+ "styled-components": "^6.0.7"
53
+ },
54
+ "devDependencies": {
55
+ "@commitlint/cli": "^17.3.0",
56
+ "@commitlint/config-conventional": "^17.3.0",
57
+ "@testing-library/dom": "^10.0.0",
58
+ "@testing-library/jest-dom": "^5.1.1",
59
+ "@testing-library/react": "^16.0.0",
60
+ "@types/jest": "^29.4.0",
61
+ "@types/react": "^18.0.0",
62
+ "@types/react-dom": "^18.0.0",
63
+ "antd": "^5.0.0",
64
+ "dumi": "^2.0.0",
65
+ "father": "^4.0.0",
66
+ "husky": "^8.0.0",
67
+ "jest": "^29.4.3",
68
+ "jest-environment-jsdom": "^29.4.3",
69
+ "lint-staged": "^13.0.0",
70
+ "prettier": "^2.0.0",
71
+ "react": "^18.0.0",
72
+ "react-dom": "^18.0.0"
73
+ },
74
+ "peerDependencies": {
75
+ "react": ">=16.9.0"
76
+ },
77
+ "engines": {},
78
+ "ci": {
79
+ "type": "aci"
80
+ },
81
+ "dumiAssets": "assets.json",
82
+ "tnpm": {
83
+ "mode": "npm"
84
+ },
85
+ "main": "dist/index.js"
86
+ }