@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.
- package/dist/index.es.js +2875 -2614
- package/dist/index.legacy.js +1 -1
- package/dist/polyfills.legacy.js +1 -1
- package/dist/style.css +1 -1
- package/dist/types/app.d.ts +1 -0
- package/dist/types/components/chat-back-bottom/chat-back-bottom.d.ts +1 -0
- package/dist/types/components/chat-container/chat-container.d.ts +4 -3
- package/dist/types/components/chat-input/chat-input.d.ts +2 -1
- package/dist/types/components/chat-input-material/chat-input-material.d.ts +1 -0
- package/dist/types/components/chat-input-material-item/chat-input-material-item.d.ts +1 -0
- package/dist/types/components/chat-input-material-item/common-material/common-material.d.ts +1 -0
- package/dist/types/components/chat-input-material-item/ossfile-material/ossfile-material.d.ts +1 -0
- package/dist/types/components/chat-message-item/chat-message-item.d.ts +1 -0
- package/dist/types/components/chat-message-item/error-message/error-message.d.ts +1 -0
- package/dist/types/components/chat-message-item/markdown-message/markdown-message.d.ts +1 -0
- package/dist/types/components/chat-message-item/unknown-message/unknown-message.d.ts +1 -0
- package/dist/types/components/chat-message-item/user-message/user-message.d.ts +1 -0
- package/dist/types/components/chat-messages/chat-messages.d.ts +1 -0
- package/dist/types/components/chat-minimize/chat-minimize.d.ts +1 -0
- package/dist/types/components/chat-search/chat-search.d.ts +1 -0
- package/dist/types/components/chat-suggestions/chat-suggestions.d.ts +1 -0
- package/dist/types/components/chat-thought-chain/chat-thought-chain.d.ts +1 -0
- package/dist/types/components/chat-tool-call/chat-tool-call.d.ts +1 -0
- package/dist/types/components/chat-tool-call-item/chat-tool-call-item.d.ts +1 -0
- package/dist/types/components/chat-toolbar/chat-toolbar-item/chat-toolbar-item.d.ts +1 -0
- package/dist/types/components/chat-toolbar/chat-toolbar.d.ts +1 -0
- package/dist/types/components/chat-topic-item/chat-topic-item.d.ts +1 -0
- package/dist/types/components/chat-topics/chat-topics.d.ts +1 -0
- package/dist/types/components/popup/popup.d.ts +6 -5
- package/dist/types/controller/ai-chat/ai-chat.controller.d.ts +2 -12
- package/dist/types/controller/ai-material/ai-material-factory.d.ts +1 -0
- package/dist/types/controller/ai-material/common-helper.d.ts +1 -0
- package/dist/types/controller/ai-material/file-helper.d.ts +1 -0
- package/dist/types/controller/ai-material/material-helper.d.ts +1 -0
- package/dist/types/controller/ai-topic/ai-topic.controller.d.ts +1 -0
- package/dist/types/controller/chat/chat.controller.d.ts +1 -0
- package/dist/types/entity/chart-material/chart-material.d.ts +1 -0
- package/dist/types/entity/chart-topic/chart-topic.d.ts +1 -0
- package/dist/types/entity/chat-message/chat-message.d.ts +14 -0
- package/dist/types/entity/chat-suggestion/chat-suggestion.d.ts +1 -0
- package/dist/types/global.d.ts +1 -0
- package/dist/types/icons/more-svg.d.ts +2 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/interface/i-chat-message/i-chat-message.d.ts +1 -0
- package/dist/types/interface/i-chat-options/i-chat-options.d.ts +15 -0
- package/dist/types/interface/i-chat-toolbar-item/i-chat-toolbar-item.d.ts +1 -0
- package/dist/types/interface/i-container-options/i-container-options.d.ts +1 -0
- package/dist/types/interface/i-topic-options/i-topic-options.d.ts +1 -0
- package/dist/types/utils/util/chat-suggestion-parser.d.ts +1 -0
- package/dist/types/utils/util/chat-tool-call-parser.d.ts +1 -0
- package/dist/types/utils/util/file-uploader.d.ts +1 -0
- package/dist/types/utils/util/material-resource-parser.d.ts +1 -0
- 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(
|
|
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(
|
|
130
|
-
dragHandle: import(
|
|
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
|
|
22
|
+
export declare const ChatInput: (props: ChatInputProps) => import("preact").JSX.Element;
|
|
@@ -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[]
|
|
11
|
+
actions?: ActionItem[];
|
|
11
12
|
content?: import('preact').ComponentChildren;
|
|
12
|
-
position?: Position
|
|
13
|
-
isOpen?: boolean
|
|
14
|
-
onToggleOpen?: (
|
|
15
|
-
onAction?: (
|
|
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 {
|
|
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,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
|
*
|
package/dist/types/global.d.ts
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -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
|
*
|
package/package.json
CHANGED