@blueking/ai-ui-sdk 0.0.15-beta.4 → 0.0.15-beta.40

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 (90) hide show
  1. package/dist/assets/images/ai.png +0 -0
  2. package/dist/assets/images/user.png +0 -0
  3. package/dist/assets/svg/picture-fail.svg +1 -0
  4. package/dist/common/util.d.ts +10 -0
  5. package/dist/common/util.js +34 -0
  6. package/dist/component/render-image/index.script.vue.js +37 -0
  7. package/dist/component/render-image/index.vue.d.ts +6 -0
  8. package/dist/component/render-image/index.vue.js +3 -0
  9. package/dist/component/render-input/index.script.vue.js +210 -0
  10. package/dist/component/render-input/index.vue.css +124 -0
  11. package/dist/component/render-input/index.vue.d.ts +20 -0
  12. package/dist/component/render-input/index.vue.js +5 -0
  13. package/dist/component/render-input/render-drag.script.vue.js +61 -0
  14. package/dist/component/render-input/render-drag.vue.css +28 -0
  15. package/dist/component/render-input/render-drag.vue.d.ts +13 -0
  16. package/dist/component/render-input/render-drag.vue.js +5 -0
  17. package/dist/component/render-input/render-quill.script.vue.js +197 -0
  18. package/dist/component/render-input/render-quill.vue.css +27 -0
  19. package/dist/component/render-input/render-quill.vue.d.ts +24 -0
  20. package/dist/component/render-input/render-quill.vue.js +4 -0
  21. package/dist/component/render-knowledge-icon/index.script.vue.js +40 -0
  22. package/dist/component/render-knowledge-icon/index.vue.css +4 -0
  23. package/dist/component/render-knowledge-icon/index.vue.d.ts +14 -0
  24. package/dist/component/render-knowledge-icon/index.vue.js +5 -0
  25. package/dist/component/render-markdown/mark-down-code.d.ts +2 -0
  26. package/dist/component/render-markdown/mark-down-code.js +171 -0
  27. package/dist/component/render-markdown/mark-down-emoji.d.ts +2 -0
  28. package/dist/component/render-markdown/mark-down-emoji.js +4 -0
  29. package/dist/component/render-markdown/mark-down.d.ts +74 -0
  30. package/dist/component/render-markdown/mark-down.js +147 -0
  31. package/dist/component/render-markdown/mark-down.postcss.css +129 -0
  32. package/dist/component/render-message/index.d.ts +61 -0
  33. package/dist/component/render-message/index.js +110 -0
  34. package/dist/component/render-message/openai-message.script.vue.js +215 -0
  35. package/dist/component/render-message/openai-message.vue.css +99 -0
  36. package/dist/component/render-message/openai-message.vue.d.ts +15 -0
  37. package/dist/component/render-message/openai-message.vue.js +5 -0
  38. package/dist/component/render-message/skeleton-message.script.vue.js +7 -0
  39. package/dist/component/render-message/skeleton-message.vue.css +7 -0
  40. package/dist/component/render-message/skeleton-message.vue.d.ts +2 -0
  41. package/dist/component/render-message/skeleton-message.vue.js +6 -0
  42. package/dist/component/render-message/system-message.script.vue.js +17 -0
  43. package/dist/component/render-message/system-message.vue.css +18 -0
  44. package/dist/component/render-message/system-message.vue.d.ts +6 -0
  45. package/dist/component/render-message/system-message.vue.js +5 -0
  46. package/dist/component/render-message/time-message.script.vue.js +41 -0
  47. package/dist/component/render-message/time-message.vue.css +14 -0
  48. package/dist/component/render-message/time-message.vue.d.ts +6 -0
  49. package/dist/component/render-message/time-message.vue.js +5 -0
  50. package/dist/component/render-message/token-expired-message.script.vue.js +78 -0
  51. package/dist/component/render-message/token-expired-message.vue.css +56 -0
  52. package/dist/component/render-message/token-expired-message.vue.d.ts +15 -0
  53. package/dist/component/render-message/token-expired-message.vue.js +5 -0
  54. package/dist/component/render-message/user-message.script.vue.js +230 -0
  55. package/dist/component/render-message/user-message.vue.css +90 -0
  56. package/dist/component/render-message/user-message.vue.d.ts +21 -0
  57. package/dist/component/render-message/user-message.vue.js +5 -0
  58. package/dist/component/render-stop/index.script.vue.js +24 -0
  59. package/dist/component/render-stop/index.vue.css +18 -0
  60. package/dist/component/render-stop/index.vue.d.ts +6 -0
  61. package/dist/component/render-stop/index.vue.js +5 -0
  62. package/dist/component.d.ts +5 -0
  63. package/dist/component.js +6 -0
  64. package/dist/css/fonts/iconcool.eot +0 -0
  65. package/dist/css/fonts/iconcool.svg +30 -0
  66. package/dist/css/fonts/iconcool.ttf +0 -0
  67. package/dist/css/fonts/iconcool.woff +0 -0
  68. package/dist/css/iconcool.js +1 -1
  69. package/dist/css/style.css +34 -4
  70. package/dist/event/index.js +2 -1
  71. package/dist/hooks/use-chat.d.ts +9 -8
  72. package/dist/hooks/use-chat.js +140 -75
  73. package/dist/hooks/use-click-proxy.js +1 -1
  74. package/dist/hooks/use-http.d.ts +1 -0
  75. package/dist/hooks/use-http.js +4 -0
  76. package/dist/hooks/use-mouse-drag.d.ts +13 -0
  77. package/dist/hooks/use-mouse-drag.js +59 -0
  78. package/dist/hooks/use-reference-doc.js +4 -4
  79. package/dist/http/fetch/error-interceptor.js +23 -2
  80. package/dist/http/fetch/index.js +5 -6
  81. package/dist/http/helper/agent.d.ts +7 -0
  82. package/dist/http/helper/agent.js +16 -0
  83. package/dist/http/helper/session.d.ts +10 -0
  84. package/dist/http/helper/session.js +92 -8
  85. package/dist/types/agent.d.ts +19 -0
  86. package/dist/types/enum.d.ts +6 -1
  87. package/dist/types/enum.js +7 -1
  88. package/dist/types/model.d.ts +14 -0
  89. package/dist/types/session.d.ts +7 -2
  90. package/package.json +25 -5
Binary file
Binary file
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><g ><path fill="#979BA5" d="M208 198.88l168 0-7.84 86.08 51.68 87.36L382.4 486.72l114.88-98.4 7.84-112 41.76-78.08H824.64a56 56 0 0 1 51.68 52.8V721.6L747.04 555.36a40.96 40.96 0 0 0-67.36-5.12l-145.76 146.88L384 502.56c-16-20.96-41.76-20.96-62.56 0L150.56 712.96 152 252.48A54.4 54.4 0 0 1 208 198.88M823.84 145.44l-315.04 0-48 134.4 10.08 96.8L416 432l32.96-64-37.28-96 33.76-128-242.56 1.44A106.24 106.24 0 0 0 96 248.16l2.08 524.8A104.64 104.64 0 0 0 200.16 880h624A104.64 104.64 0 0 0 928 775.2V250.24a104.96 104.96 0 0 0-104.16-104.8"/><path fill="#979BA5" d="M569.28 405.44a88.32 88.32 0 0 0 43.04 75.52 84.64 84.64 0 0 0 86.88 0 86.72 86.72 0 0 0 43.04-75.52 88.64 88.64 0 0 0-43.04-75.52 85.44 85.44 0 0 0-86.88 0 88.64 88.64 0 0 0-43.04 75.52"/></g></svg>
@@ -51,3 +51,13 @@ export declare const processPromptTemplate: (prompt: string, selectedText: strin
51
51
  * @returns 全屏的父元素
52
52
  */
53
53
  export declare const getFullScreenWrap: (target: HTMLElement) => HTMLElement | null;
54
+ /**
55
+ * 获取用户头像
56
+ * @param username 用户名
57
+ * @returns 头像地址
58
+ */
59
+ export declare function getUserImageUrl(username?: string): any;
60
+ /**
61
+ * 处理头像加载失败的场景
62
+ */
63
+ export declare function handleImageError(event: Event): void;
@@ -1,4 +1,7 @@
1
1
  import { Message } from 'bkui-vue';
2
+ import { emitEvent } from '../event/index.js';
3
+ import { EventType } from '../types/enum.js';
4
+ import userImageUrl from '../assets/images/user.png';
2
5
  /**
3
6
  * 节流,每隔一段时间执行
4
7
  * @param {*} fn 需要执行的函数
@@ -141,3 +144,34 @@ export const handleCopy = (text)=>{
141
144
  }
142
145
  return parentElement;
143
146
  };
147
+ /**
148
+ * 获取用户头像
149
+ * @param username 用户名
150
+ * @returns 头像地址
151
+ */ export function getUserImageUrl(username = '') {
152
+ var _window_BK_USER_IMAGE_URL;
153
+ if (username === 'admin') {
154
+ return userImageUrl;
155
+ }
156
+ return ((_window_BK_USER_IMAGE_URL = window.BK_USER_IMAGE_URL) === null || _window_BK_USER_IMAGE_URL === void 0 ? void 0 : _window_BK_USER_IMAGE_URL.replace('{placeholder}', username)) || userImageUrl;
157
+ }
158
+ /**
159
+ * 处理头像加载失败的场景
160
+ */ export function handleImageError(event) {
161
+ const { target } = event;
162
+ if (target.naturalWidth === 0) {
163
+ // 使用fetch API检查图片URL
164
+ fetch(target.src, {
165
+ method: 'HEAD',
166
+ credentials: 'include',
167
+ redirect: 'manual'
168
+ }).then((response)=>{
169
+ if (response.type === 'opaqueredirect') {
170
+ // 检测到重定向,调用登录方法
171
+ emitEvent(EventType.Unlogin);
172
+ }
173
+ }).catch((error)=>{
174
+ console.error('Failed to check image status:', error);
175
+ });
176
+ }
177
+ }
@@ -0,0 +1,37 @@
1
+ import { defineComponent as _defineComponent } from 'vue';
2
+ import { mergeProps as _mergeProps, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
3
+ const _hoisted_1 = [
4
+ "src"
5
+ ];
6
+ import fallbackPng from '../../assets/svg/picture-fail.svg';
7
+ export default /*@__PURE__*/ _defineComponent({
8
+ props: {
9
+ url: {},
10
+ size: {}
11
+ },
12
+ setup (__props) {
13
+ const handleImageError = (e)=>{
14
+ const target = e.target;
15
+ target.src = fallbackPng;
16
+ };
17
+ return (_ctx, _cache)=>{
18
+ return /http(s)?:\/\//.test(_ctx.url) ? (_openBlock(), _createElementBlock("img", _mergeProps({
19
+ key: 0
20
+ }, _ctx.$attrs, {
21
+ src: _ctx.url,
22
+ style: {
23
+ width: `${_ctx.size}px`,
24
+ height: `${_ctx.size}px`
25
+ },
26
+ onError: handleImageError
27
+ }), null, 16 /* FULL_PROPS */ , _hoisted_1)) : (_openBlock(), _createElementBlock("i", _mergeProps({
28
+ key: 1
29
+ }, _ctx.$attrs, {
30
+ class: `ai-ui-sdk-icon ai-ui-sdk-${_ctx.url}`,
31
+ style: {
32
+ fontSize: `${_ctx.size}px`
33
+ }
34
+ }), null, 16 /* FULL_PROPS */ ));
35
+ };
36
+ }
37
+ });
@@ -0,0 +1,6 @@
1
+ interface IProps {
2
+ url: string;
3
+ size: number;
4
+ }
5
+ declare const _default: import("vue").DefineComponent<IProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<IProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import script from './index.script.vue.js';
2
+ script.__file = "./src/component/render-image/index.vue";
3
+ export default script;
@@ -0,0 +1,210 @@
1
+ import { defineComponent as _defineComponent } from 'vue';
2
+ import { normalizeClass as _normalizeClass, createVNode as _createVNode, createElementVNode as _createElementVNode, unref as _unref, withDirectives as _withDirectives, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, normalizeStyle as _normalizeStyle, createElementBlock as _createElementBlock } from "vue";
3
+ const _hoisted_1 = {
4
+ class: "quill-container"
5
+ };
6
+ import { bkTooltips as vBkTooltips } from 'bkui-vue';
7
+ import { Close } from 'bkui-vue/lib/icon';
8
+ import { computed, nextTick, onMounted, ref, watch } from 'vue';
9
+ import RenderDrag from './render-drag.vue.js';
10
+ import RenderQuill from './render-quill.vue.js';
11
+ import { SessionContentRole } from '../../types/enum.js';
12
+ export default /*@__PURE__*/ _defineComponent({
13
+ props: {
14
+ isChatting: {
15
+ type: Boolean
16
+ },
17
+ width: {},
18
+ dragPosition: {},
19
+ id: {},
20
+ supportTools: {
21
+ type: Boolean
22
+ },
23
+ supportImage: {
24
+ type: Boolean
25
+ },
26
+ sessionId: {},
27
+ placeholder: {},
28
+ sessionContents: {}
29
+ },
30
+ emits: [
31
+ "send"
32
+ ],
33
+ setup (__props, { expose: __expose, emit: __emit }) {
34
+ const props = __props;
35
+ const emit = __emit;
36
+ const quillRef = ref();
37
+ const textHeight = ref(120);
38
+ const defaultHeight = ref(120);
39
+ const prompt = ref('');
40
+ const isUploadingImage = ref(false);
41
+ const disableTips = computed(()=>{
42
+ if (!prompt.value) {
43
+ return '请输入 Prompt 后再发送';
44
+ }
45
+ if (!prompt.value.trim()) {
46
+ return '输入的 Prompt 不能只包含空格';
47
+ }
48
+ if (props.isChatting) {
49
+ return '当前会话进行中,请等待会话结束后再发送';
50
+ }
51
+ if (isUploadingImage.value) {
52
+ return '正在上传图片,请等待图片上传完成后再发送';
53
+ }
54
+ return '';
55
+ });
56
+ const placeholder = computed(()=>{
57
+ let placeholder = '请输入 Prompt';
58
+ if (props.supportImage) {
59
+ placeholder += '\n您可以粘贴并发送图片,以查询图片相关问题';
60
+ }
61
+ if (props.supportTools) {
62
+ placeholder += '\n您可以键入“@”来快速获取该会话绑定的“知识和工具”名称来进行问答';
63
+ }
64
+ if (props.placeholder) {
65
+ placeholder = props.placeholder;
66
+ }
67
+ return placeholder;
68
+ });
69
+ const autoFocus = ()=>{
70
+ nextTick(()=>{
71
+ var _quillRef_value;
72
+ (_quillRef_value = quillRef.value) === null || _quillRef_value === void 0 ? void 0 : _quillRef_value.focus();
73
+ });
74
+ };
75
+ const handleChangeTextHeight = ()=>{
76
+ nextTick(()=>{
77
+ const elm = document.querySelector('.send-prompt-container .ql-editor');
78
+ if ((elm === null || elm === void 0 ? void 0 : elm.scrollHeight) > defaultHeight.value && prompt.value) {
79
+ textHeight.value = elm.scrollHeight <= 400 ? elm.scrollHeight : 400;
80
+ } else {
81
+ textHeight.value = defaultHeight.value;
82
+ }
83
+ });
84
+ };
85
+ // 从历史里面选择文本
86
+ const handleChooseHistory = ()=>{
87
+ var _props_sessionContents;
88
+ const userSessionContents = ((_props_sessionContents = props.sessionContents) === null || _props_sessionContents === void 0 ? void 0 : _props_sessionContents.filter((sessionContent)=>[
89
+ SessionContentRole.User,
90
+ SessionContentRole.Role,
91
+ SessionContentRole.UserImage
92
+ ].includes(sessionContent.role))) || [];
93
+ const { content } = userSessionContents[userSessionContents.length - 1];
94
+ if (content !== prompt.value) {
95
+ var _quillRef_value;
96
+ (_quillRef_value = quillRef.value) === null || _quillRef_value === void 0 ? void 0 : _quillRef_value.setText(content);
97
+ }
98
+ };
99
+ const handleKeyDown = (event)=>{
100
+ var _props_sessionContents;
101
+ // 数据
102
+ const isEmpty = prompt.value === '' || prompt.value === undefined;
103
+ // 状态
104
+ const isSpecialEnter = event.key === 'Enter' && !event.shiftKey && !event.ctrlKey && !event.metaKey && !event.isComposing;
105
+ const isShowUpHistory = event.key === 'ArrowUp' && ((_props_sessionContents = props.sessionContents) === null || _props_sessionContents === void 0 ? void 0 : _props_sessionContents.length) && isEmpty;
106
+ if (isSpecialEnter) {
107
+ event.preventDefault();
108
+ handleSendPrompt();
109
+ }
110
+ if (isShowUpHistory) {
111
+ handleChooseHistory();
112
+ }
113
+ };
114
+ const handleChangeInput = (val)=>{
115
+ prompt.value = val;
116
+ };
117
+ const handleClearUserPrompt = ()=>{
118
+ var _quillRef_value;
119
+ (_quillRef_value = quillRef.value) === null || _quillRef_value === void 0 ? void 0 : _quillRef_value.setText('');
120
+ };
121
+ const handleSetPrompt = (val)=>{
122
+ var _quillRef_value;
123
+ (_quillRef_value = quillRef.value) === null || _quillRef_value === void 0 ? void 0 : _quillRef_value.setText(val);
124
+ };
125
+ const handleSendPrompt = ()=>{
126
+ var // 清空
127
+ _quillRef_value;
128
+ // 没内容或执行中不做操作
129
+ if (disableTips.value) return;
130
+ // 发送
131
+ emit('send', prompt.value);
132
+ (_quillRef_value = quillRef.value) === null || _quillRef_value === void 0 ? void 0 : _quillRef_value.setText('');
133
+ };
134
+ watch(()=>prompt.value, (val)=>{
135
+ handleChangeTextHeight();
136
+ });
137
+ onMounted(autoFocus);
138
+ __expose({
139
+ handleSetPrompt
140
+ });
141
+ return (_ctx, _cache)=>{
142
+ return _openBlock(), _createElementBlock("section", {
143
+ class: _normalizeClass([
144
+ 'send-prompt-container',
145
+ _ctx.$attrs.class
146
+ ]),
147
+ style: _normalizeStyle({
148
+ '--text-height': textHeight.value + 'px',
149
+ '--default-height': defaultHeight.value + 'px',
150
+ '--textarea-bottom': -textHeight.value + 'px'
151
+ })
152
+ }, [
153
+ _createElementVNode("section", _hoisted_1, [
154
+ _createVNode(RenderQuill, {
155
+ "is-uploading-image": isUploadingImage.value,
156
+ "onUpdate:isUploadingImage": _cache[0] || (_cache[0] = ($event)=>isUploadingImage.value = $event),
157
+ value: prompt.value,
158
+ placeholder: placeholder.value,
159
+ "session-id": _ctx.sessionId,
160
+ "support-image": _ctx.supportImage,
161
+ class: _normalizeClass({
162
+ 'send-prompt': true
163
+ }),
164
+ ref_key: "quillRef",
165
+ ref: quillRef,
166
+ onKeydown: handleKeyDown,
167
+ onChange: handleChangeInput
168
+ }, null, 8 /* PROPS */ , [
169
+ "is-uploading-image",
170
+ "value",
171
+ "placeholder",
172
+ "session-id",
173
+ "support-image"
174
+ ])
175
+ ]),
176
+ _withDirectives(_createElementVNode("i", {
177
+ class: _normalizeClass({
178
+ 'ai-ui-sdk-icon ai-ui-sdk-fasong': true,
179
+ 'disable': disableTips.value
180
+ }),
181
+ onMousedown: handleSendPrompt
182
+ }, null, 34 /* CLASS, NEED_HYDRATION */ ), [
183
+ [
184
+ _unref(vBkTooltips),
185
+ {
186
+ content: disableTips.value,
187
+ disabled: !disableTips.value
188
+ }
189
+ ]
190
+ ]),
191
+ prompt.value ? (_openBlock(), _createBlock(_unref(Close), {
192
+ key: 0,
193
+ class: "show-clear-only-hover bk-input--clear-icon bk-input--suffix-icon clear-icon",
194
+ onClick: handleClearUserPrompt
195
+ })) : _createCommentVNode("v-if", true),
196
+ _createVNode(RenderDrag, {
197
+ "default-height": defaultHeight.value,
198
+ "onUpdate:defaultHeight": _cache[1] || (_cache[1] = ($event)=>defaultHeight.value = $event),
199
+ "text-height": textHeight.value,
200
+ "onUpdate:textHeight": _cache[2] || (_cache[2] = ($event)=>textHeight.value = $event),
201
+ position: _ctx.dragPosition
202
+ }, null, 8 /* PROPS */ , [
203
+ "default-height",
204
+ "text-height",
205
+ "position"
206
+ ])
207
+ ], 6 /* CLASS, STYLE */ );
208
+ };
209
+ }
210
+ });
@@ -0,0 +1,124 @@
1
+
2
+ .send-prompt-container[data-v-27s3rhz4] {
3
+ width: 800px;
4
+ z-index: 1501;
5
+ overflow: visible;
6
+ position: relative;
7
+ }
8
+ .send-prompt-container[data-v-27s3rhz4] .textarea-list {
9
+ bottom: var(--textarea-bottom);
10
+ }
11
+ .send-prompt-container:hover .clear-icon[data-v-27s3rhz4] {
12
+ display: inline-flex !important;
13
+ }
14
+ .quill-container[data-v-27s3rhz4] {
15
+ background: #fff;
16
+ box-shadow: 0 0 6px 0 #0000001a;
17
+ border-radius: 4px;
18
+ box-sizing: border-box !important;
19
+ border: 1px solid transparent;
20
+ }
21
+ .quill-container.active[data-v-27s3rhz4] {
22
+ border: 1px solid #3A84FF !important;
23
+ }
24
+ .quill-container[data-v-27s3rhz4]:has(.ql-editor:focus) {
25
+ border: 1px solid #3A84FF !important;
26
+ }
27
+ .send-prompt[data-v-27s3rhz4] {
28
+ width: 800px;
29
+ border: 1px solid transparent;
30
+ flex-direction: row;
31
+ height: var(--default-height);
32
+ min-height: 50px;
33
+ position: relative;
34
+ border-radius: 4px;
35
+ border: 1px solid transparent !important;
36
+ }
37
+ .send-prompt[data-v-27s3rhz4] .content-input-wrapper {
38
+ padding: 0 !important;
39
+ height: 100% !important;
40
+ }
41
+ .send-prompt[data-v-27s3rhz4] .auto-textarea-wrapper {
42
+ height: 100% !important;
43
+ }
44
+ .send-prompt[data-v-27s3rhz4] .v-note-panel {
45
+ border-radius: 4px;
46
+ }
47
+ .send-prompt[data-v-27s3rhz4] .scroll-style {
48
+ overflow-y: hidden !important;
49
+ }
50
+ .send-prompt[data-v-27s3rhz4] .auto-textarea-block {
51
+ display: none;
52
+ }
53
+ .send-prompt[data-v-27s3rhz4]:has(.ql-editor:focus) {
54
+ height: var(--text-height);
55
+ }
56
+ .ai-ui-sdk-fasong[data-v-27s3rhz4] {
57
+ width: 28px;
58
+ height: 28px;
59
+ line-height: 28px;
60
+ border-radius: 2px;
61
+ font-size: 20px;
62
+ cursor: pointer;
63
+ color: #979BA5;
64
+ position: absolute;
65
+ right: 6px;
66
+ bottom: 35px;
67
+ text-align: center;
68
+ z-index: 1501;
69
+ }
70
+ .ai-ui-sdk-fasong[data-v-27s3rhz4]:hover {
71
+ background: #F0F5FF;
72
+ color: #3a84ff;
73
+ }
74
+ .ai-ui-sdk-fasong.disable[data-v-27s3rhz4] {
75
+ color: #dcdee5;
76
+ cursor: not-allowed;
77
+ }
78
+ .clear-icon[data-v-27s3rhz4] {
79
+ display: none !important;
80
+ position: absolute;
81
+ bottom: 42px;
82
+ right: 28px;
83
+ height: 14px;
84
+ z-index: 1501;
85
+ }
86
+
87
+
88
+ .input-search {
89
+ margin: 8px 12px 0;
90
+ width: calc(100% - 24px);
91
+ position: relative;
92
+ border-bottom: 1px solid #eaebf0 !important;
93
+ }
94
+ .input-search:before {
95
+ content: '';
96
+ position: absolute;
97
+ left: -13px;
98
+ top: -9px;
99
+ height: 42px;
100
+ width: 1px;
101
+ background-color: #DCDEE5;
102
+ }
103
+ .input-search::after {
104
+ content: '';
105
+ position: absolute;
106
+ right: -13px;
107
+ top: -9px;
108
+ height: 42px;
109
+ width: 1px;
110
+ background-color: #DCDEE5;
111
+ }
112
+ .input-search.is-focused, .input-search:hover {
113
+ background-color: transparent !important;
114
+ }
115
+ .input-search.is-focused .bk-input--text, .input-search:hover .bk-input--text {
116
+ background-color: transparent !important;
117
+ }
118
+ .search-icon {
119
+ font-size: 18px;
120
+ color: #979BA5;
121
+ }
122
+ .prompt-tips {
123
+ max-width: 300px;
124
+ }
@@ -0,0 +1,20 @@
1
+ import type { ISessionContent } from '@/types/session';
2
+ interface IProps {
3
+ isChatting: boolean;
4
+ width: number | string;
5
+ dragPosition?: string;
6
+ id: number | string;
7
+ supportTools: boolean;
8
+ supportImage: boolean;
9
+ sessionId: string;
10
+ placeholder?: string;
11
+ sessionContents?: ISessionContent[];
12
+ }
13
+ declare const _default: import("vue").DefineComponent<IProps, {
14
+ handleSetPrompt: (val: string) => void;
15
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
16
+ send: (prompt: string) => any;
17
+ }, string, import("vue").PublicProps, Readonly<IProps> & Readonly<{
18
+ onSend?: ((prompt: string) => any) | undefined;
19
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import script from './index.script.vue.js';
2
+ script.__scopeId = "data-v-27s3rhz4";
3
+ script.__file = "./src/component/render-input/index.vue";
4
+ import './index.vue.css';
5
+ export default script;
@@ -0,0 +1,61 @@
1
+ import { defineComponent as _defineComponent } from 'vue';
2
+ import { unref as _unref, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
3
+ import { useMouseDrag } from '../../hooks/use-mouse-drag.js';
4
+ export default /*@__PURE__*/ _defineComponent({
5
+ props: {
6
+ defaultHeight: {},
7
+ textHeight: {},
8
+ position: {}
9
+ },
10
+ emits: [
11
+ "update:defaultHeight",
12
+ "update:textHeight"
13
+ ],
14
+ setup (__props, { emit: __emit }) {
15
+ const props = __props;
16
+ const emits = __emit;
17
+ const handleMouseDrag = (positionInfo)=>{
18
+ let defaultHeight = props.position === 'bottom' ? props.defaultHeight + positionInfo.singleMoveDistance.y : props.defaultHeight - positionInfo.singleMoveDistance.y;
19
+ if (defaultHeight >= 400) {
20
+ defaultHeight = 400;
21
+ }
22
+ if (defaultHeight <= 84) {
23
+ defaultHeight = 84;
24
+ }
25
+ emits('update:defaultHeight', defaultHeight);
26
+ emits('update:textHeight', defaultHeight);
27
+ };
28
+ const { isDragging } = useMouseDrag([
29
+ 'send-tool-container',
30
+ 'ai-ui-sdk-gengduo'
31
+ ], handleMouseDrag);
32
+ return (_ctx, _cache)=>{
33
+ return _ctx.position === 'bottom' ? (_openBlock(), _createElementBlock("span", {
34
+ key: 0,
35
+ class: _normalizeClass([
36
+ 'send-tool-container',
37
+ 'bottom',
38
+ {
39
+ 'is-dragging': _unref(isDragging)
40
+ }
41
+ ])
42
+ }, _cache[0] || (_cache[0] = [
43
+ _createElementVNode("i", {
44
+ class: "ai-ui-sdk-icon ai-ui-sdk-gengduo"
45
+ }, null, -1 /* HOISTED */ )
46
+ ]), 2 /* CLASS */ )) : (_openBlock(), _createElementBlock("span", {
47
+ key: 1,
48
+ class: _normalizeClass([
49
+ 'send-tool-container',
50
+ {
51
+ 'is-dragging': _unref(isDragging)
52
+ }
53
+ ])
54
+ }, _cache[1] || (_cache[1] = [
55
+ _createElementVNode("i", {
56
+ class: "ai-ui-sdk-icon ai-ui-sdk-gengduo"
57
+ }, null, -1 /* HOISTED */ )
58
+ ]), 2 /* CLASS */ ));
59
+ };
60
+ }
61
+ });
@@ -0,0 +1,28 @@
1
+
2
+ .send-tool-container[data-v-i732o63a] {
3
+ position: absolute;
4
+ left: 50%;
5
+ top: 16px;
6
+ transform: translateX(-50%);
7
+ height: 1.5px;
8
+ width: 100%;
9
+ display: flex;
10
+ justify-content: center;
11
+ font-size: 14px;
12
+ cursor: row-resize;
13
+ z-index: 15001;
14
+ }
15
+ .send-tool-container.bottom[data-v-i732o63a] {
16
+ bottom: 0;
17
+ top: auto;
18
+ }
19
+ .send-tool-container.bottom .ai-ui-sdk-gengduo[data-v-i732o63a] {
20
+ margin-top: -10px;
21
+ }
22
+ .send-tool-container[data-v-i732o63a]:hover, .send-tool-container.is-dragging[data-v-i732o63a] {
23
+ background: #3A84FF;
24
+ }
25
+ .send-tool-container .ai-ui-sdk-gengduo[data-v-i732o63a] {
26
+ margin-top: -2px;
27
+ color: #63656E;
28
+ }
@@ -0,0 +1,13 @@
1
+ interface IProps {
2
+ defaultHeight: number;
3
+ textHeight: number;
4
+ position?: string;
5
+ }
6
+ declare const _default: import("vue").DefineComponent<IProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
7
+ "update:defaultHeight": (defaultHeight: number) => any;
8
+ "update:textHeight": (textHeight: number) => any;
9
+ }, string, import("vue").PublicProps, Readonly<IProps> & Readonly<{
10
+ "onUpdate:defaultHeight"?: ((defaultHeight: number) => any) | undefined;
11
+ "onUpdate:textHeight"?: ((textHeight: number) => any) | undefined;
12
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import script from './render-drag.script.vue.js';
2
+ script.__scopeId = "data-v-i732o63a";
3
+ script.__file = "./src/component/render-input/render-drag.vue";
4
+ import './render-drag.vue.css';
5
+ export default script;