fix: 前端消息拆分+动作消息样式+DevTools自主思考状态保持+记忆表名修复
- 侧边栏底部 "昔涟 AI" 改为 "昔涟" - 暂时禁用消息朗读按钮 - 修复前端 response 处理器:支持 gateway 发送的 content+role+msg_type 字段, 使动作消息(括号内容)正确拆分为独立的 ActionMessageBubble 显示 - 修复 DevTools 自主思考面板:5秒自动刷新后展开的思考日志不再自动折叠 - 修复 memory-service 表名不一致:memory_entries → memories, 解决 DevTools 记忆管理页面查不到 admin 用户记忆的问题 - 修复 sessionStore 解析历史消息时 msgType 未定义引用 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -252,8 +252,8 @@ export function MessageBubble({
|
||||
|
||||
{!isStreaming && (
|
||||
<>
|
||||
{/* AI 消息操作栏(朗读按钮) */}
|
||||
{!isUser && <AIMessageActions content={content} />}
|
||||
{/* AI 消息操作栏(朗读按钮)— 暂时禁用 */}
|
||||
{/* !isUser && <AIMessageActions content={content} /> */}
|
||||
<p
|
||||
className={`text-xs mt-1 ${
|
||||
isUser ? 'text-pink-100' : 'text-gray-400'
|
||||
|
||||
@@ -289,7 +289,7 @@ export function Sidebar({ onClose }: SidebarProps) {
|
||||
<div className="flex items-center gap-2 mt-3 text-xs text-gray-400">
|
||||
<CyreneAvatar size="sm" />
|
||||
<div>
|
||||
<p className="font-medium text-pink-400">昔涟 AI</p>
|
||||
<p className="font-medium text-pink-400">昔涟</p>
|
||||
<p>v0.1.0 MVP</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useChatStore } from '@/store/chatStore';
|
||||
import { useSessionStore } from '@/store/sessionStore';
|
||||
import { useNotificationStore } from '@/store/notificationStore';
|
||||
import { getToken } from '@/api/client';
|
||||
import type { Message, WSClientMessage, WSServerMessage } from '@/types/chat';
|
||||
import type { Message, WSClientMessage, WSServerMessage, MessageDisplayType } from '@/types/chat';
|
||||
|
||||
function getWsUrl(): string {
|
||||
if (import.meta.env.VITE_WS_URL) return import.meta.env.VITE_WS_URL;
|
||||
@@ -202,12 +202,14 @@ function handleServerMessage(msg: WSServerMessage) {
|
||||
|
||||
switch (msg.type) {
|
||||
case 'response':
|
||||
if (msg.text) {
|
||||
// 支持两种格式: 旧版 (text 字段) 和 审查消息版 (content + role + msg_type 字段)
|
||||
if (msg.text || msg.content) {
|
||||
addMessage({
|
||||
id: msg.message_id || '',
|
||||
role: 'assistant',
|
||||
content: msg.text,
|
||||
role: (msg.role as Message['role']) || 'assistant',
|
||||
content: (msg.text || msg.content) as string,
|
||||
timestamp: msg.timestamp,
|
||||
msgType: (msg.msg_type as MessageDisplayType) || undefined,
|
||||
});
|
||||
}
|
||||
setTyping(false);
|
||||
|
||||
@@ -146,7 +146,7 @@ export const useSessionStore = create<SessionStore>((set, get) => ({
|
||||
content: typeof raw.content === 'string' ? raw.content : '',
|
||||
timestamp: typeof raw.created_at === 'number' ? (raw.created_at as number) : Date.now(),
|
||||
isStreaming: false as const,
|
||||
msgType: msgType as Message["msgType"],
|
||||
msgType: (raw.msg_type as Message['msgType']) || undefined,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -127,6 +127,7 @@ export interface WSServerMessage {
|
||||
text?: string;
|
||||
content?: string;
|
||||
role?: string;
|
||||
msg_type?: string;
|
||||
session_id?: string;
|
||||
segments?: VoiceSegment[];
|
||||
full_audio_url?: string;
|
||||
|
||||
Reference in New Issue
Block a user