Commit 8aee09f
committed
Feat: Add extensive diagnostic logging for chat history transformation
To diagnose potential context loss leading to reduced AI performance (observed as 'history size: 2'), this commit introduces detailed logging throughout the chat history processing lifecycle:
1. **ScreenCaptureService:**
* Logs the structure of the raw AI response received, including details of any `FunctionCallPart`s.
2. **PhotoReasoningViewModel:**
* `updateAiMessage` and your message creation in `performReasoning`: Logs details of messages being added to the UI-facing `_chatState.messages`.
* `rebuildChatHistory`:
* Logs the size of the input `_chatState.messages` list.
* Logs how each `PhotoReasoningMessage` is processed into text components for SDK `Content`.
* Logs the size and detailed structure (parts and their types) of the final `List<SDK.Content>` it produces.
* `sendMessageWithRetry`:
* Logs the size and detailed structure of `chat.history` (the output of `rebuildChatHistory`) just before it's serialized with DTOs and sent to `ScreenCaptureService`.
This logging aims to provide a clear trace to identify at what stage (AI response -> UI message store -> SDK history rebuild -> pre-serialization history) any discrepancies or loss of complex `Part` information might be occurring.1 parent 09b84bc commit 8aee09f
File tree
2 files changed
+40
-0
lines changed- app/src/main/kotlin/com/google/ai/sample
- feature/multimodal
2 files changed
+40
-0
lines changedLines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
248 | 249 | | |
249 | 250 | | |
250 | 251 | | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
251 | 257 | | |
252 | 258 | | |
253 | 259 | | |
| |||
Lines changed: 34 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
| 239 | + | |
239 | 240 | | |
| 241 | + | |
240 | 242 | | |
241 | 243 | | |
242 | 244 | | |
| |||
379 | 381 | | |
380 | 382 | | |
381 | 383 | | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
382 | 398 | | |
383 | 399 | | |
384 | 400 | | |
| |||
455 | 471 | | |
456 | 472 | | |
457 | 473 | | |
| 474 | + | |
458 | 475 | | |
459 | 476 | | |
460 | 477 | | |
| |||
481 | 498 | | |
482 | 499 | | |
483 | 500 | | |
| 501 | + | |
484 | 502 | | |
485 | 503 | | |
486 | 504 | | |
| |||
634 | 652 | | |
635 | 653 | | |
636 | 654 | | |
| 655 | + | |
637 | 656 | | |
638 | 657 | | |
639 | 658 | | |
| |||
687 | 706 | | |
688 | 707 | | |
689 | 708 | | |
| 709 | + | |
690 | 710 | | |
691 | 711 | | |
692 | 712 | | |
| |||
697 | 717 | | |
698 | 718 | | |
699 | 719 | | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
700 | 734 | | |
701 | 735 | | |
702 | 736 | | |
| |||
0 commit comments