优化对话体验
This commit is contained in:
parent
87525721e2
commit
c8facdaffb
@ -41,7 +41,7 @@ def select_model(model_provider=None, model_name=None):
|
||||
return OpenModel(model_name)
|
||||
|
||||
elif model_provider == "custom":
|
||||
model_info = next((x for x in conf.custom_models if x["custom_id"] == model_name), None)
|
||||
model_info = next((x for x in config.custom_models if x["custom_id"] == model_name), None)
|
||||
if model_info is None:
|
||||
raise ValueError(f"Model {model_name} not found in custom models")
|
||||
|
||||
|
||||
@ -545,6 +545,18 @@ onMounted(() => {
|
||||
|
||||
chatContainer.value.addEventListener('scroll', handleUserScroll);
|
||||
|
||||
// 检查现有消息中是否有内容为空的情况
|
||||
if (conv.value.messages && conv.value.messages.length > 0) {
|
||||
conv.value.messages.forEach(msg => {
|
||||
if (msg.role === 'received' && (!msg.text || msg.text.trim() === '')) {
|
||||
msg.status = 'error';
|
||||
msg.message = '内容加载失败';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
console.log(conv.value.messages)
|
||||
|
||||
// 从本地存储加载数据
|
||||
const storedMeta = localStorage.getItem('meta');
|
||||
if (storedMeta) {
|
||||
|
||||
@ -34,6 +34,10 @@
|
||||
<i>正在生成……</i>
|
||||
</div>
|
||||
|
||||
<div v-else-if="status === 'error'" class="err-msg" @click="$emit('retry')">
|
||||
请求错误,请重试。{{ errorMessage }}
|
||||
</div>
|
||||
|
||||
<!-- 消息内容 -->
|
||||
<div v-else-if="contentHtml" v-html="contentHtml" class="message-md"></div>
|
||||
|
||||
@ -42,11 +46,7 @@
|
||||
|
||||
<!-- 引用组件 (ChatComponent特有) -->
|
||||
<slot name="refs"></slot>
|
||||
</div>
|
||||
|
||||
<!-- 错误消息 -->
|
||||
<div v-else-if="status === 'error'" class="err-msg" @click="$emit('retry')">
|
||||
请求错误,请重试。{{ errorMessage }}
|
||||
<!-- 错误消息 -->
|
||||
</div>
|
||||
|
||||
<!-- 自定义内容 -->
|
||||
@ -161,7 +161,6 @@ const isEmptyAndLoading = computed(() => {
|
||||
text-align: left;
|
||||
margin: 0 0 16px 0;
|
||||
padding: 0px;
|
||||
text-align: justify;
|
||||
background-color: transparent;
|
||||
border-radius: 0;
|
||||
}
|
||||
@ -195,12 +194,12 @@ const isEmptyAndLoading = computed(() => {
|
||||
}
|
||||
|
||||
.err-msg {
|
||||
color: #eb8080;
|
||||
border: 1px solid #eb8080;
|
||||
color: #d15252;
|
||||
border: 1px solid #f19999;
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 8px;
|
||||
text-align: left;
|
||||
background: #FFF5F5;
|
||||
background: #fffbfb;
|
||||
margin-bottom: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user