Skip to content

Commit 21bd6c2

Browse files
committed
update
1 parent dd0d450 commit 21bd6c2

File tree

1 file changed

+5
-2
lines changed
  • wren-ai-service/src/web/v1/services

1 file changed

+5
-2
lines changed

wren-ai-service/src/web/v1/services/ask.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
class AskHistory(BaseModel):
1717
response: str = Field(alias=AliasChoices("response", "sql"))
18+
type: Literal["text", "sql"] = "sql"
1819
question: str
1920

2021

@@ -257,10 +258,12 @@ async def ask(
257258
if self._allow_intent_classification:
258259
last_sql_data = None
259260
if histories:
260-
if last_sql := histories[-1].response:
261+
if (last_response := histories[-1].response) and histories[
262+
-1
263+
].type == "sql":
261264
last_sql_data = (
262265
await self._pipelines["sql_executor"].run(
263-
sql=last_sql,
266+
sql=last_response,
264267
project_id=ask_request.project_id,
265268
)
266269
)["execute_sql"]["results"]

0 commit comments

Comments
 (0)