Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 85f3400076 | |||
| a5cbe98f25 |
@@ -119,7 +119,7 @@ public class DashboardController(OpenClawGatewayClient gateway, ILogger<Dashboar
|
||||
{
|
||||
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));
|
||||
|
||||
// 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')
|
||||
if (!res.ok) return
|
||||
const data: DashboardChatMessage[] = await res.json()
|
||||
chatMessages.value = data.map((msg, idx) => ({
|
||||
id: `msg-${idx}`,
|
||||
sender: msg.role === 'assistant' ? 'iris' : 'user',
|
||||
text: msg.content,
|
||||
timestamp: new Date(msg.timestamp).getTime(),
|
||||
}))
|
||||
// Merge instead of replace — only add messages not already present
|
||||
const existingTexts = new Set(chatMessages.value.map(m => m.text))
|
||||
const existingTimestamps = new Set(chatMessages.value.map(m => m.timestamp))
|
||||
for (const msg of data) {
|
||||
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 {
|
||||
// API unreachable – keep current values
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user