@ibiz-template-plugin/ai-chat 0.0.30 → 0.0.31

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.
Files changed (53) hide show
  1. package/dist/index.es.js +2875 -2614
  2. package/dist/index.legacy.js +1 -1
  3. package/dist/polyfills.legacy.js +1 -1
  4. package/dist/style.css +1 -1
  5. package/dist/types/app.d.ts +1 -0
  6. package/dist/types/components/chat-back-bottom/chat-back-bottom.d.ts +1 -0
  7. package/dist/types/components/chat-container/chat-container.d.ts +4 -3
  8. package/dist/types/components/chat-input/chat-input.d.ts +2 -1
  9. package/dist/types/components/chat-input-material/chat-input-material.d.ts +1 -0
  10. package/dist/types/components/chat-input-material-item/chat-input-material-item.d.ts +1 -0
  11. package/dist/types/components/chat-input-material-item/common-material/common-material.d.ts +1 -0
  12. package/dist/types/components/chat-input-material-item/ossfile-material/ossfile-material.d.ts +1 -0
  13. package/dist/types/components/chat-message-item/chat-message-item.d.ts +1 -0
  14. package/dist/types/components/chat-message-item/error-message/error-message.d.ts +1 -0
  15. package/dist/types/components/chat-message-item/markdown-message/markdown-message.d.ts +1 -0
  16. package/dist/types/components/chat-message-item/unknown-message/unknown-message.d.ts +1 -0
  17. package/dist/types/components/chat-message-item/user-message/user-message.d.ts +1 -0
  18. package/dist/types/components/chat-messages/chat-messages.d.ts +1 -0
  19. package/dist/types/components/chat-minimize/chat-minimize.d.ts +1 -0
  20. package/dist/types/components/chat-search/chat-search.d.ts +1 -0
  21. package/dist/types/components/chat-suggestions/chat-suggestions.d.ts +1 -0
  22. package/dist/types/components/chat-thought-chain/chat-thought-chain.d.ts +1 -0
  23. package/dist/types/components/chat-tool-call/chat-tool-call.d.ts +1 -0
  24. package/dist/types/components/chat-tool-call-item/chat-tool-call-item.d.ts +1 -0
  25. package/dist/types/components/chat-toolbar/chat-toolbar-item/chat-toolbar-item.d.ts +1 -0
  26. package/dist/types/components/chat-toolbar/chat-toolbar.d.ts +1 -0
  27. package/dist/types/components/chat-topic-item/chat-topic-item.d.ts +1 -0
  28. package/dist/types/components/chat-topics/chat-topics.d.ts +1 -0
  29. package/dist/types/components/popup/popup.d.ts +6 -5
  30. package/dist/types/controller/ai-chat/ai-chat.controller.d.ts +2 -12
  31. package/dist/types/controller/ai-material/ai-material-factory.d.ts +1 -0
  32. package/dist/types/controller/ai-material/common-helper.d.ts +1 -0
  33. package/dist/types/controller/ai-material/file-helper.d.ts +1 -0
  34. package/dist/types/controller/ai-material/material-helper.d.ts +1 -0
  35. package/dist/types/controller/ai-topic/ai-topic.controller.d.ts +1 -0
  36. package/dist/types/controller/chat/chat.controller.d.ts +1 -0
  37. package/dist/types/entity/chart-material/chart-material.d.ts +1 -0
  38. package/dist/types/entity/chart-topic/chart-topic.d.ts +1 -0
  39. package/dist/types/entity/chat-message/chat-message.d.ts +14 -0
  40. package/dist/types/entity/chat-suggestion/chat-suggestion.d.ts +1 -0
  41. package/dist/types/global.d.ts +1 -0
  42. package/dist/types/icons/more-svg.d.ts +2 -2
  43. package/dist/types/index.d.ts +1 -0
  44. package/dist/types/interface/i-chat-message/i-chat-message.d.ts +1 -0
  45. package/dist/types/interface/i-chat-options/i-chat-options.d.ts +15 -0
  46. package/dist/types/interface/i-chat-toolbar-item/i-chat-toolbar-item.d.ts +1 -0
  47. package/dist/types/interface/i-container-options/i-container-options.d.ts +1 -0
  48. package/dist/types/interface/i-topic-options/i-topic-options.d.ts +1 -0
  49. package/dist/types/utils/util/chat-suggestion-parser.d.ts +1 -0
  50. package/dist/types/utils/util/chat-tool-call-parser.d.ts +1 -0
  51. package/dist/types/utils/util/file-uploader.d.ts +1 -0
  52. package/dist/types/utils/util/material-resource-parser.d.ts +1 -0
  53. package/package.json +2 -1
@@ -2,6 +2,7 @@ import { Component } from 'preact';
2
2
  import { Namespace } from '../../utils';
3
3
  import { AiChatController, AiTopicController } from '../../controller';
4
4
  import { IChatToolbarItem, IChatContainerOptions } from '../../interface';
5
+
5
6
  export interface ChatContainerProps {
6
7
  /**
7
8
  * 呈现模式
@@ -113,7 +114,7 @@ interface ContainerContext {
113
114
  enableBackFill: boolean;
114
115
  newTopic: Function;
115
116
  }
116
- export declare const ContainerContext: import("preact").Context<ContainerContext>;
117
+ export declare const ContainerContext: import('preact').Context<ContainerContext>;
117
118
  /**
118
119
  * 聊天窗口容器,可拖拽,可缩放
119
120
  *
@@ -126,8 +127,8 @@ export declare const ContainerContext: import("preact").Context<ContainerContext
126
127
  export declare class ChatContainer extends Component<ChatContainerProps, ChatContainerState> {
127
128
  constructor(props: ChatContainerProps | undefined);
128
129
  ns: Namespace;
129
- containerRef: import("preact").RefObject<HTMLDivElement>;
130
- dragHandle: import("preact").RefObject<HTMLDivElement>;
130
+ containerRef: import('preact').RefObject<HTMLDivElement>;
131
+ dragHandle: import('preact').RefObject<HTMLDivElement>;
131
132
  /**
132
133
  * 窗口样式数据
133
134
  *
@@ -1,5 +1,6 @@
1
1
  import { AiChatController } from '../../controller';
2
2
  import { IChatToolbarItem } from '../../interface';
3
+
3
4
  export interface ChatInputProps {
4
5
  /**
5
6
  * 单实例聊天总控
@@ -18,4 +19,4 @@ export interface ChatInputProps {
18
19
  */
19
20
  questionToolbarItems?: IChatToolbarItem[];
20
21
  }
21
- export declare const ChatInput: (props: ChatInputProps) => import("preact/compat").JSX.Element;
22
+ export declare const ChatInput: (props: ChatInputProps) => import("preact").JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import { AiChatController } from '../../controller';
2
+
2
3
  export interface ChatInputMaterialProps {
3
4
  /**
4
5
  * 聊天实例
@@ -1,6 +1,7 @@
1
1
  import { h } from 'preact';
2
2
  import { AiChatController } from '../../controller';
3
3
  import { IMaterial } from '../../interface';
4
+
4
5
  export interface ChatInputMaterialtemProps {
5
6
  /**
6
7
  * 聊天控制器
@@ -1,5 +1,6 @@
1
1
  import { AiChatController } from '../../../controller';
2
2
  import { IMaterial } from '../../../interface';
3
+
3
4
  export interface CommonMaterialProps {
4
5
  controller: AiChatController;
5
6
  material: IMaterial;
@@ -1,5 +1,6 @@
1
1
  import { AiChatController } from '../../../controller';
2
2
  import { IMaterial } from '../../../interface';
3
+
3
4
  export interface OssfileMaterialProps {
4
5
  controller: AiChatController;
5
6
  material: IMaterial;
@@ -1,6 +1,7 @@
1
1
  import { VNode, h } from 'preact';
2
2
  import { IChatMessage } from '../../interface';
3
3
  import { AiChatController } from '../../controller';
4
+
4
5
  export interface ChatMessageItemProps {
5
6
  /**
6
7
  * 单实例聊天总控
@@ -1,6 +1,7 @@
1
1
  import { VNode } from 'preact';
2
2
  import { IChatMessage } from '../../../interface';
3
3
  import { AiChatController } from '../../../controller';
4
+
4
5
  export interface ErrorMessageProps {
5
6
  /**
6
7
  * 单实例聊天总控
@@ -1,6 +1,7 @@
1
1
  import { VNode } from 'preact';
2
2
  import { IChatMessage } from '../../../interface';
3
3
  import { AiChatController } from '../../../controller';
4
+
4
5
  export interface MarkdownMessageProps {
5
6
  /**
6
7
  * 单实例聊天总控
@@ -1,4 +1,5 @@
1
1
  import { IChatMessage } from '../../../interface';
2
+
2
3
  export interface UnknownMessageProps {
3
4
  message: IChatMessage;
4
5
  /**
@@ -1,6 +1,7 @@
1
1
  import { VNode } from 'preact';
2
2
  import { IChatMessage } from '../../../interface';
3
3
  import { AiChatController } from '../../../controller';
4
+
4
5
  export interface UserMessageProps {
5
6
  controller: AiChatController;
6
7
  message: IChatMessage;
@@ -1,5 +1,6 @@
1
1
  import { AiChatController } from '../../controller';
2
2
  import { IChatToolbarItem } from '../../interface';
3
+
3
4
  export interface ChatMessageProps {
4
5
  /**
5
6
  * 单实例聊天总控
@@ -1,4 +1,5 @@
1
1
  import { AiChatController } from '../../controller';
2
+
2
3
  export interface ChatMinimizeProps {
3
4
  /**
4
5
  * 单实例聊天总控
@@ -1,3 +1,4 @@
1
+
1
2
  export interface ChatSearchProps {
2
3
  /**
3
4
  * 值
@@ -1,4 +1,5 @@
1
1
  import { IChatSuggestion } from '../../interface';
2
+
2
3
  export interface ChatSuggestionsProps {
3
4
  /**
4
5
  * 聊天建议集合
@@ -1,4 +1,5 @@
1
1
  import { IChatThoughtChain } from '../../interface';
2
+
2
3
  export interface ChatThoughtChainProps {
3
4
  /**
4
5
  * @description AI聊天思维链
@@ -1,4 +1,5 @@
1
1
  import { IChatToolCall } from '../../interface';
2
+
2
3
  export interface ChatToolCallProps {
3
4
  /**
4
5
  * @description 工具调用集合
@@ -1,4 +1,5 @@
1
1
  import { IChatToolCall } from '../../interface';
2
+
2
3
  export interface ChatToolCallItemProps {
3
4
  /**
4
5
  * @description 工具调用
@@ -1,4 +1,5 @@
1
1
  import { IChatToolbarItem } from '../../../interface';
2
+
2
3
  export interface ChatToolberItemProps {
3
4
  /**
4
5
  * 工具栏项模型
@@ -1,5 +1,6 @@
1
1
  import { IChatToolbarItem } from '../../interface';
2
2
  import { AiChatController } from '../../controller';
3
+
3
4
  export interface ChatToolbarProps {
4
5
  /**
5
6
  * 单实例聊天总控
@@ -1,5 +1,6 @@
1
1
  import { ChatTopic } from '../../entity';
2
2
  import { AiTopicController } from '../../controller';
3
+
3
4
  export interface ChatTopicItemProps {
4
5
  controller: AiTopicController;
5
6
  topic: ChatTopic;
@@ -1,4 +1,5 @@
1
1
  import { AiTopicController } from '../../controller';
2
+
2
3
  export interface ChatTopicProps {
3
4
  /**
4
5
  * 话题控制器
@@ -1,4 +1,5 @@
1
1
  import { VNode } from 'preact';
2
+
2
3
  type Position = 'top' | 'bottom' | 'left' | 'right' | 'top-left';
3
4
  interface ActionItem {
4
5
  id: string;
@@ -7,11 +8,11 @@ interface ActionItem {
7
8
  }
8
9
  export declare const Popup: ({ children, actions, content, position, isOpen: isOpenProp, onToggleOpen, onAction, }: {
9
10
  children: import('preact').ComponentChildren;
10
- actions?: ActionItem[] | undefined;
11
+ actions?: ActionItem[];
11
12
  content?: import('preact').ComponentChildren;
12
- position?: Position | undefined;
13
- isOpen?: boolean | undefined;
14
- onToggleOpen?: ((isOpen: boolean) => void) | undefined;
15
- onAction?: ((actionId: string, event: MouseEvent) => void) | undefined;
13
+ position?: Position;
14
+ isOpen?: boolean;
15
+ onToggleOpen?: (isOpen: boolean) => void;
16
+ onAction?: (actionId: string, event: MouseEvent) => void;
16
17
  }) => import("preact").JSX.Element;
17
18
  export {};
@@ -1,6 +1,7 @@
1
1
  import { Signal } from '@preact/signals';
2
2
  import { ChatMessage } from '../../entity';
3
- import { IChatMessage, IChatOptions, IChatSuggestion, IMaterial, ITopic } from '../../interface';
3
+ import { ITopic, IMaterial, IChatMessage, IChatOptions, IChatSuggestion } from '../../interface';
4
+
4
5
  /**
5
6
  * 聊天逻辑控制器
6
7
  *
@@ -89,17 +90,6 @@ export declare class AiChatController {
89
90
  * @memberof AiChatController
90
91
  */
91
92
  chatSessionid: string;
92
- /**
93
- * 聊天窗触发提问回调
94
- *
95
- * @author tony001
96
- * @date 2025-02-24 14:02:51
97
- * @param {object} context
98
- * @param {object} params
99
- * @param {object} otherParams
100
- * @param {IChatMessage[]} question 提问历史内容(包含当前提问)
101
- * @return {*} {Promise<boolean>} 等待回答
102
-
103
93
  /**
104
94
  * Creates an instance of AiChatController.
105
95
  *
@@ -1,6 +1,7 @@
1
1
  import { AiChatController } from '../ai-chat/ai-chat.controller';
2
2
  import { CommonHelper } from './common-helper';
3
3
  import { FileHelper } from './file-helper';
4
+
4
5
  export declare class AIMaterialFactory {
5
6
  static getMaterialHelper(type: string, aiChat: AiChatController): CommonHelper | FileHelper;
6
7
  }
@@ -1,5 +1,6 @@
1
1
  import { IChatToolbarItem } from '../../interface';
2
2
  import { MaterialHelper } from './material-helper';
3
+
3
4
  export declare class CommonHelper extends MaterialHelper {
4
5
  /**
5
6
  * 执行操作
@@ -1,5 +1,6 @@
1
1
  import { IChatToolbarItem, IMaterial } from '../../interface';
2
2
  import { MaterialHelper } from './material-helper';
3
+
3
4
  export declare class FileHelper extends MaterialHelper {
4
5
  /**
5
6
  * 执行操作
@@ -1,5 +1,6 @@
1
1
  import { IChatToolbarItem } from '../../interface';
2
2
  import { AiChatController } from '../ai-chat/ai-chat.controller';
3
+
3
4
  export declare abstract class MaterialHelper {
4
5
  protected aiChat: AiChatController;
5
6
  constructor(aiChat: AiChatController);
@@ -2,6 +2,7 @@ import { Signal } from '@preact/signals';
2
2
  import { ChatTopic } from '../../entity';
3
3
  import { ITopic, ITopicOptions } from '../../interface';
4
4
  import { ChatController } from '../chat/chat.controller';
5
+
5
6
  /**
6
7
  * ai话题控制器
7
8
  *
@@ -2,6 +2,7 @@ import { IContainerOptions } from '../../interface';
2
2
  import { AiTopicController } from '../ai-topic/ai-topic.controller';
3
3
  import { AiChatController } from '../ai-chat/ai-chat.controller';
4
4
  import { ChatTopic } from '../../entity';
5
+
5
6
  /**
6
7
  * 聊天器控制器
7
8
  *
@@ -1,4 +1,5 @@
1
1
  import { IMaterial } from '../../interface';
2
+
2
3
  export declare class ChatMaterial implements IMaterial {
3
4
  material: IMaterial;
4
5
  get id(): IMaterial['id'];
@@ -1,4 +1,5 @@
1
1
  import { ITopic } from '../../interface';
2
+
2
3
  /**
3
4
  * 话题实体
4
5
  *
@@ -1,4 +1,5 @@
1
1
  import { IChatMessage } from '../../interface';
2
+
2
3
  /**
3
4
  * 消息实体
4
5
  *
@@ -11,6 +12,13 @@ import { IChatMessage } from '../../interface';
11
12
  export declare class ChatMessage implements IChatMessage {
12
13
  protected msg: IChatMessage;
13
14
  toolcalls: IChatMessage['toolcalls'];
15
+ /**
16
+ * @description 消息的所有原始内容
17
+ * - 用于维护工具调用消息数据
18
+ * @type {string}
19
+ * @memberof ChatMessage
20
+ */
21
+ allcontent: string;
14
22
  get messageid(): IChatMessage['messageid'];
15
23
  get state(): IChatMessage['state'];
16
24
  get role(): IChatMessage['role'];
@@ -29,6 +37,12 @@ export declare class ChatMessage implements IChatMessage {
29
37
  * @param {IChatMessage} msg
30
38
  */
31
39
  update(msg: IChatMessage): void;
40
+ /**
41
+ * @description 替换消息
42
+ * @param {IChatMessage} msg
43
+ * @memberof ChatMessage
44
+ */
45
+ replace(msg: IChatMessage): void;
32
46
  /**
33
47
  * 更新消息完成状态
34
48
  *
@@ -1,4 +1,5 @@
1
1
  import { IChatSuggestion } from '../../interface';
2
+
2
3
  export declare class ChatSuggestion implements IChatSuggestion {
3
4
  suggestion: IChatSuggestion;
4
5
  get type(): IChatSuggestion['type'];
@@ -1,2 +1,3 @@
1
1
  import { PluginStaticResource } from './utils';
2
+
2
3
  export declare const resource: PluginStaticResource;
@@ -1,4 +1,4 @@
1
1
  export declare const MoreSvg: (props: {
2
- className?: string | undefined;
3
- onClick?: ((event: MouseEvent) => void) | undefined;
2
+ className?: string;
3
+ onClick?: (event: MouseEvent) => void;
4
4
  }) => import("preact").JSX.Element;
@@ -1,3 +1,4 @@
1
+
1
2
  export { ChatContainer } from './components';
2
3
  export { chat } from './controller';
3
4
  export type { IChatToolbarItem } from './interface';
@@ -1,6 +1,7 @@
1
1
  import { IChatSuggestion } from '../i-chat-suggestion/i-chat-suggestion';
2
2
  import { IChatToolCall } from '../i-chat-tool-call/i-chat-tool-call';
3
3
  import { IPortalAsyncAction } from '../i-portal-async-action/i-portal-async-action';
4
+
4
5
  /**
5
6
  * AI聊天消息
6
7
  *
@@ -3,6 +3,7 @@ import { IChatMessage } from '../i-chat-message/i-chat-message';
3
3
  import { IChatToolbarItem } from '../i-chat-toolbar-item/i-chat-toolbar-item';
4
4
  import { FileUploaderOptions } from '../i-file-uploader-options/i-file-uploader-options';
5
5
  import { ITopic } from '../i-topic-options/i-topic-options';
6
+
6
7
  /**
7
8
  * 聊天数据
8
9
  *
@@ -43,6 +44,20 @@ export interface IChat {
43
44
  * @type {string}
44
45
  */
45
46
  appDataEntityId: string;
47
+ /**
48
+ * @description 自动提问
49
+ * - 历史数据最后一个项是user时是否自动提问,默认开启
50
+ * @type {boolean}
51
+ * @memberof IChat
52
+ */
53
+ autoQuestion?: boolean;
54
+ /**
55
+ * @description 是否自动回填
56
+ * - AI回答完成之后是否触发回填,默认关闭
57
+ * @type {boolean}
58
+ * @memberof IChat
59
+ */
60
+ autoFill?: boolean;
46
61
  /**
47
62
  * 传入对象参数(如果外部传入,在请求历史记录,需要附加当前参数)
48
63
  *
@@ -1,4 +1,5 @@
1
1
  import { VNode } from 'preact';
2
+
2
3
  /**
3
4
  * 聊天自定义工具栏项接口
4
5
  *
@@ -1,6 +1,7 @@
1
1
  import { IChatContainerOptions } from '../i-chat-container/i-chat-container';
2
2
  import { IChatOptions } from '../i-chat-options/i-chat-options';
3
3
  import { ITopicOptions } from '../i-topic-options/i-topic-options';
4
+
4
5
  /**
5
6
  * ai容器配置参数
6
7
  *
@@ -1,5 +1,6 @@
1
1
  import { IChat } from '../i-chat-options/i-chat-options';
2
2
  import { IConfigService } from '../i-config-service/i-config-service';
3
+
3
4
  /**
4
5
  * 话题数据
5
6
  *
@@ -1,4 +1,5 @@
1
1
  import { IChatSuggestion } from '../../interface';
2
+
2
3
  /**
3
4
  * 聊天建议解析器
4
5
  *
@@ -1,4 +1,5 @@
1
1
  import { IChatToolCall } from '../../interface';
2
+
2
3
  /**
3
4
  * @description 工具调用解析器
4
5
  * @export
@@ -1,4 +1,5 @@
1
1
  import { FileUploaderOptions } from '../../interface';
2
+
2
3
  /**
3
4
  * 文件上传器
4
5
  *
@@ -1,4 +1,5 @@
1
1
  import { IMaterial } from '../../interface';
2
+
2
3
  /**
3
4
  * 素材资源解析器
4
5
  *
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@ibiz-template-plugin/ai-chat",
3
- "version": "0.0.30",
3
+ "version": "0.0.31",
4
4
  "description": "iBiz AI交互框插件",
5
+ "type": "module",
5
6
  "main": "dist/index.es.js",
6
7
  "module": "dist/index.es.js",
7
8
  "types": "dist/types/index.d.ts",