fix: display optim
This commit is contained in:
@@ -261,12 +261,18 @@ export function ChatInterface() {
|
|||||||
try {
|
try {
|
||||||
const data = await api.get<SessionData>(`/nanobot/sessions/${activeSessionKey}`);
|
const data = await api.get<SessionData>(`/nanobot/sessions/${activeSessionKey}`);
|
||||||
if (data.messages && data.messages.length > 0) {
|
if (data.messages && data.messages.length > 0) {
|
||||||
const formattedMessages = data.messages.map((m, idx) => ({
|
const formattedMessages = data.messages
|
||||||
id: `${Date.now()}-${idx}`,
|
.filter((m) => {
|
||||||
role: m.role as 'user' | 'assistant',
|
if (m.role === 'system' || m.role === 'tool' || m.role === 'function') return false;
|
||||||
content: m.content,
|
if (m.role === 'assistant' && m.tool_calls && m.tool_calls.length > 0 && !m.viz) return false;
|
||||||
viz: m.viz ? buildMessageViz(m.viz) : undefined,
|
return true;
|
||||||
}));
|
})
|
||||||
|
.map((m, idx) => ({
|
||||||
|
id: `${Date.now()}-${idx}`,
|
||||||
|
role: m.role as 'user' | 'assistant',
|
||||||
|
content: m.content || "",
|
||||||
|
viz: m.viz ? buildMessageViz(m.viz) : undefined,
|
||||||
|
}));
|
||||||
setMessagesForSession(activeSessionKey, formattedMessages);
|
setMessagesForSession(activeSessionKey, formattedMessages);
|
||||||
} else {
|
} else {
|
||||||
setMessagesForSession(activeSessionKey, []);
|
setMessagesForSession(activeSessionKey, []);
|
||||||
|
|||||||
Reference in New Issue
Block a user