fix(orm): fixed history context in chat mode#30
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the history context in chat mode by enhancing conversation history management and updating chat completions processing. The key changes include:
- Adding Node version control commands (nvm install/use) to test tools scripts.
- Introducing a global conversation history dictionary with trimming logic in the server.
- Updating functions in the chat completions flow to store and merge conversation history.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| test_tools/call_codex_mcp.sh | Inserts nvm install/use commands to ensure the correct Node version. |
| test_tools/call_codex.sh | Inserts nvm install/use commands similar to the MCP variant. |
| src/open_responses_server/server.py | Adds conversation history logic and updates chat completions processing. |
| docs/prompts/add-chat-completions-history.md | Documents new conversation history behavior. |
| messages.append(assistant_message) | ||
|
|
||
| # Add the tool response for immediate tools | ||
| if is_mcp: |
There was a problem hiding this comment.
Ensure that 'is_mcp' is defined in this scope before its usage. For example, assign is_mcp = is_mcp_tool(tool_call['function']['name']) prior to the if-check to avoid undefined variable errors.
| logger.info(f"Saved conversation history for response_id {response_id} with {len(messages)} messages") | ||
|
|
||
| # Trim conversation history if it grows too large | ||
| if len(conversation_history) > MAX_CONVERSATION_HISTORY: |
There was a problem hiding this comment.
[nitpick] Consider refactoring the conversation history trimming logic into a helper function to avoid code duplication and improve maintainability.
|




No description provided.