centaline-data-driven-v3 0.0.81 → 0.0.82
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/package.json
CHANGED
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
<template v-for="message in model.messages">
|
|
18
18
|
<div :key="message.id" class="message" v-if="message.content"
|
|
19
19
|
:class="{ 'user-message': message.sender === 'user', 'ai-message': message.sender === 'ai' }">
|
|
20
|
-
<div class="chat-message" :style="{color:message.type=='error'?'red':''}"
|
|
20
|
+
<div class="chat-message" :style="{ color: message.type == 'error' ? 'red' : '' }"
|
|
21
|
+
v-html="htmlContent(message)">
|
|
21
22
|
</div>
|
|
22
23
|
</div>
|
|
23
24
|
<div v-else class="loading-container">
|
|
@@ -29,7 +30,8 @@
|
|
|
29
30
|
<!-- 输入区域 -->
|
|
30
31
|
<div class="chat-editor" v-if="showAI">
|
|
31
32
|
<div class="chat-input-editor-container">
|
|
32
|
-
<textarea ref="textareaRef" class="chat-input"
|
|
33
|
+
<textarea ref="textareaRef" class="chat-input"
|
|
34
|
+
v-model="inputMessage" @keydown="handleKeydown"
|
|
33
35
|
:placeholder="model.placeholder"></textarea>
|
|
34
36
|
|
|
35
37
|
|
|
@@ -55,7 +57,7 @@
|
|
|
55
57
|
|
|
56
58
|
|
|
57
59
|
<script setup lang="ts">
|
|
58
|
-
import { ref,
|
|
60
|
+
import { ref, onActivated, nextTick, watch, computed } from 'vue'
|
|
59
61
|
import AIChat from '../../loader/src/AIChat'
|
|
60
62
|
import common from '../../utils/common'
|
|
61
63
|
import { marked } from 'marked';
|
|
@@ -139,6 +141,13 @@ function load(data) {
|
|
|
139
141
|
action();
|
|
140
142
|
}
|
|
141
143
|
|
|
144
|
+
onActivated(() => {
|
|
145
|
+
nextTick(() => {
|
|
146
|
+
if (inputMessage.value) {
|
|
147
|
+
inputMessage.value.focus();
|
|
148
|
+
}
|
|
149
|
+
})
|
|
150
|
+
})
|
|
142
151
|
// Marked 配置
|
|
143
152
|
marked.setOptions({
|
|
144
153
|
breaks: true,
|
|
@@ -225,9 +234,9 @@ const scheduleScroll = (flagScroll) => {
|
|
|
225
234
|
if (!scrollPending) {
|
|
226
235
|
if (messagesContainer.value) {
|
|
227
236
|
const container = messagesContainer.value;
|
|
228
|
-
|
|
237
|
+
|
|
229
238
|
const distanceToBottom = container.scrollHeight - (container.scrollTop + container.clientHeight);
|
|
230
|
-
if (flagScroll||distanceToBottom <= 20) {
|
|
239
|
+
if (flagScroll || distanceToBottom <= 20) {
|
|
231
240
|
scrollPending = true
|
|
232
241
|
nextTick(() => {
|
|
233
242
|
if (messagesContainer.value) {
|
|
@@ -636,9 +645,9 @@ function hideAI() {
|
|
|
636
645
|
overflow: auto;
|
|
637
646
|
resize: none;
|
|
638
647
|
/* 禁用手动调整大小 */
|
|
639
|
-
min-height:
|
|
648
|
+
min-height: 40px;
|
|
640
649
|
/* 设置最大高度 */
|
|
641
|
-
max-height:
|
|
650
|
+
max-height: 65px;
|
|
642
651
|
/* 设置最大高度 */
|
|
643
652
|
}
|
|
644
653
|
|
|
@@ -647,6 +656,10 @@ function hideAI() {
|
|
|
647
656
|
outline: none;
|
|
648
657
|
}
|
|
649
658
|
|
|
659
|
+
.chat-input::placeholder {
|
|
660
|
+
color: #a8abb2;
|
|
661
|
+
opacity: 1;
|
|
662
|
+
}
|
|
650
663
|
.chat-editor-action {
|
|
651
664
|
display: flex;
|
|
652
665
|
justify-content: space-between;
|