修复Agent页面的消息报错提示
This commit is contained in:
parent
565b502f25
commit
e7262c04b0
@ -345,40 +345,21 @@ const updateMessage = (info) => {
|
||||
const msg = conv.value.messages.find((msg) => msg.id === info.id);
|
||||
if (msg) {
|
||||
try {
|
||||
// 只有在 text 不为空时更新
|
||||
if (info.content !== null && info.content !== undefined && info.content !== '') {
|
||||
// 特殊处理:content需要追加而不是替换
|
||||
if (info.content != null && info.content !== '') {
|
||||
msg.content += info.content;
|
||||
}
|
||||
|
||||
if (info.reasoning_content !== null && info.reasoning_content !== undefined && info.reasoning_content !== '') {
|
||||
msg.reasoning_content = info.reasoning_content;
|
||||
}
|
||||
// 批量处理其他属性,只有当属性值不为null/undefined且不为空字符串时才更新
|
||||
const propertiesToUpdate = [
|
||||
'reasoning_content', 'model_name', 'status', 'message', 'showThinking', 'refs', 'meta'
|
||||
];
|
||||
|
||||
// 只有在 refs 不为空时更新
|
||||
if (info.refs !== null && info.refs !== undefined) {
|
||||
msg.refs = info.refs;
|
||||
}
|
||||
|
||||
if (info.model_name !== null && info.model_name !== undefined && info.model_name !== '') {
|
||||
msg.model_name = info.model_name;
|
||||
}
|
||||
|
||||
// 只有在 status 不为空时更新
|
||||
if (info.status !== null && info.status !== undefined && info.status !== '') {
|
||||
msg.status = info.status;
|
||||
}
|
||||
|
||||
if (info.meta !== null && info.meta !== undefined) {
|
||||
msg.meta = info.meta;
|
||||
}
|
||||
|
||||
if (info.message !== null && info.message !== undefined) {
|
||||
msg.message = info.message;
|
||||
}
|
||||
|
||||
if (info.showThinking !== null && info.showThinking !== undefined) {
|
||||
msg.showThinking = info.showThinking;
|
||||
}
|
||||
propertiesToUpdate.forEach(prop => {
|
||||
if (info[prop] != null && (typeof info[prop] !== 'string' || info[prop] !== '')) {
|
||||
msg[prop] = info[prop];
|
||||
}
|
||||
});
|
||||
|
||||
scrollToBottom();
|
||||
} catch (error) {
|
||||
|
||||
@ -51,9 +51,10 @@
|
||||
:key="message.id"
|
||||
class="message-md"/>
|
||||
|
||||
<div v-else-if="message.reasoning_content" class="searching-msg">
|
||||
<!-- <i>正在思考……</i> -->
|
||||
</div>
|
||||
<div v-else-if="message.reasoning_content" class="empty-block"></div>
|
||||
|
||||
<!-- 工具调用 (AgentView特有) -->
|
||||
<slot v-else-if="message.toolCalls && Object.keys(message.toolCalls).length > 0" name="tool-calls"></slot>
|
||||
|
||||
<div v-else class="err-msg" @click="$emit('retry')">
|
||||
请求错误,请重试。{{ message.message }}
|
||||
@ -64,8 +65,6 @@
|
||||
<span class="retry-link" @click="emit('retryStoppedMessage', message.id)">重新编辑问题</span>
|
||||
</div>
|
||||
|
||||
<!-- 工具调用 (AgentView特有) -->
|
||||
<slot name="tool-calls"></slot>
|
||||
|
||||
<div v-if="(message.role=='received' || message.role=='assistant') && message.status=='finished' && showRefs">
|
||||
<RefsComponent :message="message" :show-refs="showRefs" @retry="emit('retry')" />
|
||||
|
||||
Loading…
Reference in New Issue
Block a user