Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 85f3400076 | |||
| a5cbe98f25 |
@@ -119,7 +119,7 @@ public class DashboardController(OpenClawGatewayClient gateway, ILogger<Dashboar
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var key = string.IsNullOrWhiteSpace(sessionKey) ? "iris" : sessionKey.Trim();
|
var key = string.IsNullOrWhiteSpace(sessionKey) ? "agent:iris:main" : sessionKey.Trim();
|
||||||
var messages = await gateway.GetSessionHistoryAsync(key, Math.Clamp(limit, 1, 200), Math.Max(0, offset));
|
var messages = await gateway.GetSessionHistoryAsync(key, Math.Clamp(limit, 1, 200), Math.Max(0, offset));
|
||||||
|
|
||||||
// Filter: only user and assistant messages (exclude tool/system)
|
// Filter: only user and assistant messages (exclude tool/system)
|
||||||
|
|||||||
@@ -280,12 +280,19 @@ async function fetchChatMessages(): Promise<void> {
|
|||||||
const res = await apiFetch('/api/dashboard/chat/messages?limit=50')
|
const res = await apiFetch('/api/dashboard/chat/messages?limit=50')
|
||||||
if (!res.ok) return
|
if (!res.ok) return
|
||||||
const data: DashboardChatMessage[] = await res.json()
|
const data: DashboardChatMessage[] = await res.json()
|
||||||
chatMessages.value = data.map((msg, idx) => ({
|
// Merge instead of replace — only add messages not already present
|
||||||
id: `msg-${idx}`,
|
const existingTexts = new Set(chatMessages.value.map(m => m.text))
|
||||||
sender: msg.role === 'assistant' ? 'iris' : 'user',
|
const existingTimestamps = new Set(chatMessages.value.map(m => m.timestamp))
|
||||||
text: msg.content,
|
for (const msg of data) {
|
||||||
timestamp: new Date(msg.timestamp).getTime(),
|
const msgTime = new Date(msg.timestamp).getTime()
|
||||||
}))
|
if (existingTexts.has(msg.content) && existingTimestamps.has(msgTime)) continue
|
||||||
|
chatMessages.value.push({
|
||||||
|
id: `msg-${msgTime}-${msg.role}`,
|
||||||
|
sender: msg.role === 'assistant' ? 'iris' : 'user',
|
||||||
|
text: msg.content,
|
||||||
|
timestamp: msgTime,
|
||||||
|
})
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
// API unreachable – keep current values
|
// API unreachable – keep current values
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user