Skip to content

Commit 5028316

Browse files
committed
fix chat loading
1 parent 29a69f7 commit 5028316

File tree

2 files changed

+78
-5
lines changed

2 files changed

+78
-5
lines changed

gui/src/utils/style.js

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,69 @@ const chatTheme = (viewHeight) => {
5050
}
5151
}
5252
const auxiliaryStyle = () => {
53+
const common = `
54+
.inner-message-container{
55+
position:relative;
56+
}
57+
.lds-ripple {
58+
color: #1c4c5b
59+
}
60+
.lds-ripple,
61+
.lds-ripple div {
62+
box-sizing: border-box;
63+
}
64+
.lds-ripple {
65+
display: inline-block;
66+
position: relative;
67+
width: 80px;
68+
height: 80px;
69+
}
70+
.lds-ripple div {
71+
position: absolute;
72+
border: 4px solid currentColor;
73+
opacity: 1;
74+
border-radius: 50%;
75+
animation: lds-ripple 1s cubic-bezier(0, 0.2, 0.8, 1) infinite;
76+
}
77+
.lds-ripple div:nth-child(2) {
78+
animation-delay: -0.5s;
79+
}
80+
@keyframes lds-ripple {
81+
0% {
82+
top: 36px;
83+
left: 36px;
84+
width: 8px;
85+
height: 8px;
86+
opacity: 0;
87+
}
88+
4.9% {
89+
top: 36px;
90+
left: 36px;
91+
width: 8px;
92+
height: 8px;
93+
opacity: 0;
94+
}
95+
5% {
96+
top: 36px;
97+
left: 36px;
98+
width: 8px;
99+
height: 8px;
100+
opacity: 1;
101+
}
102+
100% {
103+
top: 0;
104+
left: 0;
105+
width: 80px;
106+
height: 80px;
107+
opacity: 0;
108+
}
109+
}`
53110
if(isDrak()){
54-
return "::-webkit-scrollbar-thumb, ::-webkit-scrollbar-track { background-color: #1c1c1c;}";
111+
return `${common}
112+
::-webkit-scrollbar-thumb, ::-webkit-scrollbar-track { background-color: #1c1c1c;}`;
55113
} else {
56-
return "::-webkit-scrollbar-thumb, ::-webkit-scrollbar-track { background-color: #ffffff;}";
114+
return `${common}
115+
::-webkit-scrollbar-thumb, ::-webkit-scrollbar-track { background-color: #ffffff;}`;
57116
}
58117
}
59118

@@ -111,8 +170,21 @@ const messageStyles = () => {
111170
"wordBreak": "break-all",
112171
// "marginTop":"15px","marginBottom":"15px"
113172
}
173+
const loading = {
174+
"bubble": {"backgroundColor": "#9855f7", "fontSize": "20px", "color": "white"},
175+
"history": {
176+
"full": {
177+
"styles": {"outerContainer": {"marginTop": "28px"}},
178+
"html": "<div class=\"lds-ripple\"><div></div><div></div></div>"
179+
},
180+
"small": {
181+
"styles": {"outerContainer": {"marginTop": "-10px", "marginBottom": "50px"}},
182+
},
183+
}
184+
}
114185
if(isDrak()){
115186
return {
187+
loading,
116188
"default": {
117189
ai: {
118190
innerContainer,
@@ -130,6 +202,7 @@ const messageStyles = () => {
130202
};
131203
} else {
132204
return {
205+
loading,
133206
"default": {
134207
ai: {
135208
innerContainer,

gui/src/views/chat/BotChat.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ const postMessage = (message, callback) => {
195195
botService.chatLLM(llm.value, message).then((res)=>{
196196
console.log('resp:',res)
197197
const msg = res.choices[0]?.message?.reasoning_content||res.choices[0]?.message?.content||'';
198-
callback(`<pre style="white-space: pre-wrap;word-wrap: break-word;overflow-wrap: break-word;background:transparent">${msg}</pre>`);
198+
callback(`<pre style="white-space: pre-wrap;word-wrap: break-word;overflow-wrap: break-word;background:transparent;color:var(--text-color);margin:0;">${msg}</pre>`);
199199
});
200200
}
201201
const forwardTarget = ref();
@@ -436,14 +436,14 @@ defineExpose({
436436
:dragAndDrop='style.dragAndDrop()'
437437
:style='style.chatTheme(viewHeight)'
438438
v-model:history="history"
439-
:displayLoadingBubble="false"
439+
:displayLoadingBubble="true"
440440
:htmlClassUtilities="htmlClassUtilities()"
441441
:messageStyles='style.messageStyles()'
442442
:inputAreaStyle='style.inputAreaStyle()'
443443
:textInput="inputStyle"
444444
:auxiliaryStyle="style.auxiliaryStyle()"
445445
:dropupStyles='style.dropupStyles()'
446-
:demo='{"displayLoadingBubble": false}'
446+
:demo='{"displayLoadingBubble": true,"displayLoading": {"history": {"full": true},"message": true}}'
447447
:stream="false"
448448
:connect="request"
449449
:requestInterceptor="requestInterceptor"

0 commit comments

Comments
 (0)