Skip to content

Commit dc62d28

Browse files
committed
Merge branch 'feature/agent-chat-history-fixes' into 'develop'
Feature/agent chat history fixes See merge request genaiic-reusable-assets/engagement-artifacts/genaiic-idp-accelerator!414
2 parents 14544dc + a471714 commit dc62d28

File tree

6 files changed

+49
-15
lines changed

6 files changed

+49
-15
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@ SPDX-License-Identifier: MIT-0
55

66
## [Unreleased]
77

8+
## [0.4.2]
9+
10+
### Changed
11+
12+
- **Agent Companion Chat - Chat History Feature**
13+
- Added chat history feature from Agent Analysis back into Agent Companion Chat
14+
- Users can now load and view previous chat sessions with full conversation context
15+
- Chat history dropdown displays recent sessions with timestamps and message counts
16+
17+
### Fixed
18+
19+
- **Agent Companion Chat - Session Persistence and input control**
20+
- Agent Companion Chat in-session memory now persists even when user changes pages
21+
- Prompt input is disabled during active streaming responses to prevent concurrent requests
22+
- Fixed issue where charts in loaded chat history were not displaying
23+
824
## [0.4.1]
925

1026
### Changed

lib/idp_common_pkg/idp_common/agents/analytics/agent.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ def create_analytics_agent(
255255
Remember, DO NOT attempt to execute multiple tools in parallel. The input of some tools depend on the output of others. Only ever execute one tool at a time.
256256
257257
Also remember, DO NOT EVER GENERATE SYNTHETIC DATA. Only answer questions or generate plots based on REAL DATA retrieved from databases. If no data can be retrieved, or if there are gaps in the data, do not make up fake data. It is better to show an empty plot or explain you are unable to answer than to make up data.
258+
259+
If a tool or several tools result in error after 2 times of retry, reply by mentioning the error that has occurred and stop retrying the tool(s).
258260
259261
Your final response should be directly parsable as json with no additional text before or after. The json should conform to the result format description shown above, with top level key "responseType" being one of "plotData", "table", or "text". You may have to clean up the output of the python code if, for example, it contains extra strings from logging or otherwise. Return only directly parsable json in your final response.
260262
"""

lib/idp_common_pkg/idp_common/agents/orchestrator/agent.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ async def tool_func(query: str) -> AsyncIterator:
274274
- For table/plot responses: Return ONLY the JSON with zero additional text
275275
- Synthesize information from multiple agents when needed
276276
- Keep responses clear and user-friendly
277+
- If a subagent or several subagents result in error after 2 times of retry, reply gracefully by mentioning the error that has occurred and STOP retrying the agents.
278+
277279
"""
278280

279281
# Get model ID using configuration helper (checks env vars, config table, then defaults)

src/ui/src/components/agent-chat/AgentChatLayout.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ const AgentChatLayout = ({
360360
onChange={handleInputChange}
361361
onKeyDown={handleKeyDown}
362362
placeholder={placeholder}
363-
disabled={isLoading || isLoadingSession}
363+
disabled={isLoading || isLoadingSession || waitingForResponse}
364364
actionButtonIconName="send"
365365
onAction={handlePromptSubmit}
366366
minRows={3}

src/ui/src/hooks/use-agent-chat.js

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -495,16 +495,32 @@ const useAgentChat = (config = {}) => {
495495
}
496496

497497
// Convert messages to the format expected by the UI
498-
const formattedMessages = messagesToLoad.map((msg, index) => ({
499-
role: msg.role,
500-
content: msg.content,
501-
messageType: 'text',
502-
toolUseData: null,
503-
isProcessing: false, // Historical messages are never processing
504-
sessionId: msg.sessionId,
505-
timestamp: msg.timestamp,
506-
id: `${msg.timestamp}-${index}`,
507-
}));
498+
const formattedMessages = messagesToLoad.map((msg, index) => {
499+
const baseMessage = {
500+
role: msg.role,
501+
content: msg.content,
502+
messageType: 'text',
503+
toolUseData: null,
504+
isProcessing: false, // Historical messages are never processing
505+
sessionId: msg.sessionId,
506+
timestamp: msg.timestamp,
507+
id: `${msg.timestamp}-${index}`,
508+
};
509+
510+
// For assistant messages, parse content to extract structured data (charts, tables, etc.)
511+
if (msg.role === 'assistant' && msg.content) {
512+
const parsedData = parseResponseData(msg.content);
513+
514+
if (parsedData) {
515+
// If we found structured data, add it to the message
516+
baseMessage.parsedData = parsedData;
517+
// Update content to show only the text portion (without the JSON)
518+
baseMessage.content = parsedData.textContent || msg.content;
519+
}
520+
}
521+
522+
return baseMessage;
523+
});
508524

509525
// Update context with loaded session
510526
updateAgentChatState({

template.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,17 +249,15 @@ Parameters:
249249

250250
ChatCompanionModelId:
251251
Type: String
252-
Default: "us.anthropic.claude-3-7-sonnet-20250219-v1:0"
252+
Default: "us.anthropic.claude-sonnet-4-20250514-v1:0"
253253
AllowedValues:
254-
- "us.amazon.nova-lite-v1:0"
255254
- "us.amazon.nova-pro-v1:0"
256255
- "us.amazon.nova-premier-v1:0"
257256
- "us.anthropic.claude-3-haiku-20240307-v1:0"
258257
- "us.anthropic.claude-3-5-haiku-20241022-v1:0"
259258
- "us.anthropic.claude-3-5-sonnet-20241022-v2:0"
260259
- "us.anthropic.claude-3-7-sonnet-20250219-v1:0"
261260
- "us.anthropic.claude-sonnet-4-20250514-v1:0"
262-
- "eu.amazon.nova-lite-v1:0"
263261
- "eu.amazon.nova-pro-v1:0"
264262
- "eu.anthropic.claude-3-haiku-20240307-v1:0"
265263
- "eu.anthropic.claude-3-5-sonnet-20241022-v2:0"
@@ -532,7 +530,7 @@ Metadata:
532530
- KnowledgeBaseVectorStore
533531
- KnowledgeBaseModelId
534532
- Label:
535-
default: "Agentic Analysis"
533+
default: "Agentic Companion Chat"
536534
Parameters:
537535
- ChatCompanionModelId
538536
- Label:

0 commit comments

Comments
 (0)