Rifqi Hafizuddin commited on
Commit ·
0935ede
1
Parent(s): e4f62b8
fix: query executor now use user question as prompt (sebelumnya pakai hasil orchestrator)
Browse files- src/api/v1/chat.py +6 -1
src/api/v1/chat.py
CHANGED
|
@@ -229,11 +229,16 @@ async def chat_stream(request: ChatRequest, db: AsyncSession = Depends(get_db)):
|
|
| 229 |
|
| 230 |
source_hint = intent_result.get("source_hint", "both")
|
| 231 |
if source_hint in ("schema", "both"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 232 |
query_results = await query_executor.execute(
|
| 233 |
results=raw_results,
|
| 234 |
user_id=request.user_id,
|
| 235 |
db=db,
|
| 236 |
-
question=
|
| 237 |
)
|
| 238 |
query_context = _format_query_results(query_results)
|
| 239 |
if query_context:
|
|
|
|
| 229 |
|
| 230 |
source_hint = intent_result.get("source_hint", "both")
|
| 231 |
if source_hint in ("schema", "both"):
|
| 232 |
+
# Pass the user's raw natural-language question to the executor.
|
| 233 |
+
# `search_query` is the orchestrator's rewrite for retrieval —
|
| 234 |
+
# keyword-heavy, stripped of intent structure — and produces
|
| 235 |
+
# worse SQL when fed to db_executor. Smoke-test parity with
|
| 236 |
+
# `experiments/test_db_executor.py` requires the raw message.
|
| 237 |
query_results = await query_executor.execute(
|
| 238 |
results=raw_results,
|
| 239 |
user_id=request.user_id,
|
| 240 |
db=db,
|
| 241 |
+
question=request.message,
|
| 242 |
)
|
| 243 |
query_context = _format_query_results(query_results)
|
| 244 |
if query_context:
|