@blueking/ai-blueking 0.0.0 → 0.0.2

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/README.md CHANGED
@@ -32,6 +32,7 @@ npm i @blueking/ai-blueking
32
32
  import { ref } from 'vue';
33
33
 
34
34
  import AIBlueking from '@blueking/ai-blueking';
35
+ import '@blueking/ai-blueking/dist/vue3/style.css';
35
36
 
36
37
  // 展示的消息
37
38
  const messages = [
@@ -114,3 +115,113 @@ npm i @blueking/ai-blueking
114
115
  };
115
116
  </script>
116
117
  ```
118
+
119
+ - vue2框架下使用
120
+
121
+ vue2 下,需要安装npm包,里面是vue3资源
122
+
123
+ ```bash
124
+ npm i @blueking/bkui-library
125
+ ```
126
+
127
+ ```vue
128
+ <template>
129
+ <div class="app">
130
+ <AIBlueking
131
+ :background="background"
132
+ :head-background="headBackground"
133
+ :loading="loading"
134
+ :messages="messages"
135
+ :position-limit="positionLimit"
136
+ :prompts="prompts"
137
+ :size-limit="sizeLimit"
138
+ @choose-prompt="handleChoosePrompt"
139
+ @clear="handleClear"
140
+ @close="handleClose"
141
+ @send="handleSend"
142
+ />
143
+ </div>
144
+ </template>
145
+ <script setup lang="ts">
146
+ import { ref } from 'vue';
147
+
148
+ import AIBlueking from '@blueking/ai-blueking/vue2';
149
+ import '@blueking/ai-blueking/dist/vue2/style.css';
150
+
151
+ export default {
152
+ data() {
153
+ return {
154
+ messages: [
155
+ {
156
+ content: '你好呀',
157
+ type: 'ai',
158
+ },
159
+ {
160
+ content: '1+1=?',
161
+ type: 'user',
162
+ },
163
+ {
164
+ content: '1+1=3',
165
+ type: 'ai',
166
+ status: 'error',
167
+ },
168
+ {
169
+ content: '不对',
170
+ type: 'user',
171
+ },
172
+ {
173
+ content: '1+1=2',
174
+ type: 'ai',
175
+ status: 'loading',
176
+ },
177
+ {
178
+ content: '对了',
179
+ type: 'user',
180
+ },
181
+ {
182
+ content: '好的,任务已完成',
183
+ type: 'ai',
184
+ },
185
+ ],
186
+ prompts: [
187
+ {
188
+ id: 1,
189
+ content: '帮我计算1+1的结果',
190
+ },
191
+ {
192
+ id: 2,
193
+ content: '帮我计算2+2的结果',
194
+ },
195
+ ],
196
+ loading: false,
197
+ background: '#f5f7fa',
198
+ headBackground: 'linear-gradient(267deg, #2dd1f4 0%, #1482ff 95%)',
199
+ positionLimit: {
200
+ top: 0,
201
+ bottom: 0,
202
+ left: 0,
203
+ right: 0,
204
+ },
205
+ sizeLimit: {
206
+ height: 500,
207
+ width: 294,
208
+ },
209
+ };
210
+ },
211
+ method: {
212
+ handleClear() {
213
+ console.log('trigger clear');
214
+ },
215
+ handleSend(val: string) {
216
+ console.log('trigger send', val);
217
+ },
218
+ handleClose() {
219
+ console.log('trigger close');
220
+ },
221
+ handleChoosePrompt(prompt) {
222
+ console.log('choose prompt', prompt);
223
+ },
224
+ },
225
+ };
226
+ </script>
227
+ ```
@@ -1,4 +1,4 @@
1
- import type { IMessage, IPrompt, IPositionLimit, ISizeLimit } from './types';
1
+ import type { IMessage, IPrompt, IPositionLimit, ISizeLimit, IStartPosition } from './types';
2
2
  declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
3
3
  messages: IMessage[];
4
4
  prompts?: IPrompt[] | undefined;
@@ -7,6 +7,7 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
7
7
  background?: string | undefined;
8
8
  positionLimit?: IPositionLimit | undefined;
9
9
  sizeLimit?: ISizeLimit | undefined;
10
+ startPosition?: IStartPosition | undefined;
10
11
  userPhoto?: string | undefined;
11
12
  logo?: string | undefined;
12
13
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
@@ -22,6 +23,7 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
22
23
  background?: string | undefined;
23
24
  positionLimit?: IPositionLimit | undefined;
24
25
  sizeLimit?: ISizeLimit | undefined;
26
+ startPosition?: IStartPosition | undefined;
25
27
  userPhoto?: string | undefined;
26
28
  logo?: string | undefined;
27
29
  }>>> & {
@@ -1,9 +1,10 @@
1
- import type { IPositionLimit, ISizeLimit } from '../types';
1
+ import type { IPositionLimit, ISizeLimit, IStartPosition } from '../types';
2
2
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<{
3
3
  headBackground: string;
4
4
  positionLimit?: IPositionLimit | undefined;
5
5
  sizeLimit?: ISizeLimit | undefined;
6
6
  logo?: string | undefined;
7
+ startPosition?: IStartPosition | undefined;
7
8
  }>, {
8
9
  headBackground: string;
9
10
  positionLimit: () => {
@@ -25,6 +26,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
25
26
  positionLimit?: IPositionLimit | undefined;
26
27
  sizeLimit?: ISizeLimit | undefined;
27
28
  logo?: string | undefined;
29
+ startPosition?: IStartPosition | undefined;
28
30
  }>, {
29
31
  headBackground: string;
30
32
  positionLimit: () => {
@@ -8,5 +8,6 @@ export declare const langData: {
8
8
  readonly '\u5185\u5BB9\u6B63\u5728\u6267\u884C\u4E2D\uFF0C\u8BF7\u6267\u884C\u5B8C\u6210\u540E\u518D\u8F93\u5165': "The content is being executed, please enter it again after the execution is completed.";
9
9
  readonly 发送: "Send";
10
10
  readonly '\u60A8\u53EF\u4EE5\u952E\u5165 \u201C/\u201D \u67E5\u770B\u66F4\u591APrompt': "You can type \"/\" to see more Prompts";
11
+ readonly 请输入: "Please input";
11
12
  };
12
- export declare const t: (key: keyof typeof langData) => "BK GPT" | "shrink down" | "expand upward" | "Empty chat records" | "close" | "The content is being executed, please enter it again after the execution is completed." | "Send" | "You can type \"/\" to see more Prompts" | "小鲸" | "向下收缩" | "向上扩展" | "清空聊天记录" | "关闭" | "内容正在执行中,请执行完成后再输入" | "发送" | "您可以键入 “/” 查看更多Prompt";
13
+ export declare const t: (key: keyof typeof langData) => "BK GPT" | "shrink down" | "expand upward" | "Empty chat records" | "close" | "The content is being executed, please enter it again after the execution is completed." | "Send" | "You can type \"/\" to see more Prompts" | "Please input" | "小鲸" | "向下收缩" | "向上扩展" | "清空聊天记录" | "关闭" | "内容正在执行中,请执行完成后再输入" | "发送" | "您可以键入 “/” 查看更多Prompt" | "请输入";
@@ -17,3 +17,9 @@ export interface ISizeLimit {
17
17
  height: number;
18
18
  width: number;
19
19
  }
20
+ export interface IStartPosition {
21
+ top?: number;
22
+ bottom?: number;
23
+ left?: number;
24
+ right?: number;
25
+ }