Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Fix #359: Fix conversation storage error in summarize mode#400

Open
veeceey wants to merge 1 commit intonlweb-ai:mainfrom
veeceey:fix/issue-359-store-conversation-v2
Open

Fix #359: Fix conversation storage error in summarize mode#400
veeceey wants to merge 1 commit intonlweb-ai:mainfrom
veeceey:fix/issue-359-store-conversation-v2

Conversation

@veeceey
Copy link
Contributor

@veeceey veeceey commented Feb 6, 2026

Summary

Changes

  • Use handler.final_ranked_answers for result iteration instead of removed return_value['content']
  • Handle summarize mode by using handler.summary directly as the conversation summary
  • Fix response serialization to extract name/url/ranking from final_ranked_answers

Test plan

  • Verified final_ranked_answers structure in ranking.py (list of dicts with url, name, ranking, schema_object keys)
  • Verified handler.summary is a string set by SummarizeResults in post_ranking.py
  • Manual test: query in summarize mode, verify no storage error
  • Manual test: query in normal mode, verify conversation stored correctly

…versationExchange

The storeConversationExchange method referenced handler.return_value['content']
which no longer exists. In summarize mode, handler.summary is a plain string,
so calling .get() on it caused the error.

Changes:
- Use handler.final_ranked_answers instead of handler.return_value['content']
- Handle summarize mode by using handler.summary directly
- Fix response serialization to extract from final_ranked_answers
@veeceey veeceey force-pushed the fix/issue-359-store-conversation-v2 branch from 5a75af6 to ef3735f Compare February 6, 2026 06:51
@veeceey
Copy link
Contributor Author

veeceey commented Feb 6, 2026

Manual Test Results - Fix Verified

Tested locally with Ollama (gemma3:12b) + Qdrant local storage.

Test 1: Normal mode (list) via Chat SSE

Query: "what are the best sci-fi movies" with mode=list

Result: 1 result returned ("A Matter of Life and Death", score 78), conversation stored successfully.

{
  "user_id": "test-user-123",
  "query": "what are the best sci-fi movies",
  "conversation_id": "conv_test1770362590",
  "summary": "The query about best sci-fi movies yielded a single, highly-regarded film: A Matter of Life and Death...",
  "main_topics": ["British cinema", "World War II", "Fantasy", "Romance"],
  "response_items": 1,
  "response_names": ["A Matter of Life and Death"]
}

No errors. storeConversationExchange completed without 'str' object has no attribute 'get'.

Test 2: Summarize mode via Chat SSE

Query: "tell me about classic sci-fi movies" with mode=summarize

Result: 2 results returned + LLM-generated summary. Conversation stored successfully.

{
  "user_id": "test-user-456",
  "query": "tell me about classic sci-fi movies",
  "conversation_id": "conv_summ1770362649",
  "summary": "Classic sci-fi movies include \"A Matter of Life and Death\" (1946)... and \"Manhunt of Mystery Island\" (1945)...",
  "response_items": 2,
  "response_names": ["A Matter of Life and Death", "Manhunt of Mystery Island"]
}

No errors. The summarize mode handler.summary (a plain string) is now handled correctly without calling .get() on it.

Conversation Storage Proof

2 conversations successfully stored in Qdrant (data/conversations_db/nlweb_conversations):

# Mode Query Items Stored Summary Generated
1 list "what are the best sci-fi movies" 1 Yes (auto-generated)
2 summarize "tell me about classic sci-fi movies" 2 Yes (from summarize mode)

Error Check

grep "Error storing conversation" server.log → 0 matches
grep "'str' object has no attribute 'get'" server.log → 0 matches

The fix correctly uses handler.final_ranked_answers instead of the removed handler.return_value['content'], and handles summarize mode by using handler.summary directly as a string.

@veeceey
Copy link
Contributor Author

veeceey commented Feb 8, 2026

All checks passing ✓ CodeQL Advanced: SUCCESS | Mergeable: YES. Manual test evidence provided in PR description. Ready for maintainer review and merge.

@veeceey
Copy link
Contributor Author

veeceey commented Feb 10, 2026

Hi maintainers, friendly ping on this PR. All checks are passing and manual test evidence has been provided. Would appreciate a review when you get a chance. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ERROR - Error storing conversation: 'str' object has no attribute 'get'

1 participant