Commit 9c9fa90
feat(embedding): support multi-turn conversation context for table RAG
- Add MULTI_TURN_EMBEDDING_ENABLED and MULTI_TURN_HISTORY_COUNT config
- Add get_chat_history_questions() to retrieve recent questions from same chat
- Add build_context_query() to concatenate history questions with current question
- Update calc_table_embedding() to use context query for better table matching
- Pass history_questions through get_table_schema() to LLMService
This improves table structure retrieval accuracy by considering the full
conversation context instead of just the latest question.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>1 parent fd9a59a commit 9c9fa90
File tree
3 files changed
+91
-5
lines changed- backend/apps
- chat
- curd
- task
- datasource/embedding
3 files changed
+91
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
859 | 859 | | |
860 | 860 | | |
861 | 861 | | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
104 | 110 | | |
105 | 111 | | |
106 | 112 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
14 | 46 | | |
15 | 47 | | |
16 | 48 | | |
| |||
25 | 57 | | |
26 | 58 | | |
27 | 59 | | |
28 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
29 | 63 | | |
30 | 64 | | |
31 | 65 | | |
| |||
40 | 74 | | |
41 | 75 | | |
42 | 76 | | |
43 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
44 | 89 | | |
45 | 90 | | |
46 | 91 | | |
| |||
58 | 103 | | |
59 | 104 | | |
60 | 105 | | |
61 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
62 | 109 | | |
63 | 110 | | |
64 | 111 | | |
| |||
0 commit comments