Spaces:
Paused
Paused
Update chat_handler.py
Browse files- chat_handler.py +1 -5
chat_handler.py
CHANGED
|
@@ -344,7 +344,7 @@ async def chat(req: ChatRequest, x_session_id: str = Header(...)):
|
|
| 344 |
detail=get_user_friendly_error("version_not_found")
|
| 345 |
)
|
| 346 |
|
| 347 |
-
# Process based on current state
|
| 348 |
if session.state == "idle":
|
| 349 |
# Build intent detection prompt
|
| 350 |
prompt = build_intent_prompt(version, session.chat_history, project.default_locale)
|
|
@@ -381,7 +381,6 @@ async def chat(req: ChatRequest, x_session_id: str = Header(...)):
|
|
| 381 |
else:
|
| 382 |
# Need to collect more parameters
|
| 383 |
# Get parameter collection config
|
| 384 |
-
cfg = ConfigProvider.get()
|
| 385 |
collection_config = cfg.global_config.llm_provider.settings.get("parameter_collection_config", {})
|
| 386 |
max_params = collection_config.get("max_params_per_question", 2)
|
| 387 |
|
|
@@ -449,7 +448,6 @@ async def chat(req: ChatRequest, x_session_id: str = Header(...)):
|
|
| 449 |
else:
|
| 450 |
# Still need more parameters
|
| 451 |
# Get parameter collection config
|
| 452 |
-
cfg = ConfigProvider.get()
|
| 453 |
collection_config = cfg.global_config.llm_provider.settings.get("parameter_collection_config", {})
|
| 454 |
max_params = collection_config.get("max_params_per_question", 2)
|
| 455 |
|
|
@@ -551,7 +549,6 @@ async def handle_new_message(session: Session, user_input: str) -> str:
|
|
| 551 |
return await _execute_api_call(session, intent_config)
|
| 552 |
else:
|
| 553 |
# Need to collect more parameters
|
| 554 |
-
cfg = ConfigProvider.get()
|
| 555 |
collection_config = cfg.global_config.llm_provider.settings.get("parameter_collection_config", {})
|
| 556 |
max_params = collection_config.get("max_params_per_question", 2)
|
| 557 |
|
|
@@ -627,7 +624,6 @@ async def handle_parameter_followup(session: Session, user_input: str) -> str:
|
|
| 627 |
return await _execute_api_call(session, intent_config)
|
| 628 |
else:
|
| 629 |
# Still need more parameters
|
| 630 |
-
cfg = ConfigProvider.get()
|
| 631 |
collection_config = cfg.global_config.llm_provider.settings.get("parameter_collection_config", {})
|
| 632 |
max_params = collection_config.get("max_params_per_question", 2)
|
| 633 |
|
|
|
|
| 344 |
detail=get_user_friendly_error("version_not_found")
|
| 345 |
)
|
| 346 |
|
| 347 |
+
# Process based on current state
|
| 348 |
if session.state == "idle":
|
| 349 |
# Build intent detection prompt
|
| 350 |
prompt = build_intent_prompt(version, session.chat_history, project.default_locale)
|
|
|
|
| 381 |
else:
|
| 382 |
# Need to collect more parameters
|
| 383 |
# Get parameter collection config
|
|
|
|
| 384 |
collection_config = cfg.global_config.llm_provider.settings.get("parameter_collection_config", {})
|
| 385 |
max_params = collection_config.get("max_params_per_question", 2)
|
| 386 |
|
|
|
|
| 448 |
else:
|
| 449 |
# Still need more parameters
|
| 450 |
# Get parameter collection config
|
|
|
|
| 451 |
collection_config = cfg.global_config.llm_provider.settings.get("parameter_collection_config", {})
|
| 452 |
max_params = collection_config.get("max_params_per_question", 2)
|
| 453 |
|
|
|
|
| 549 |
return await _execute_api_call(session, intent_config)
|
| 550 |
else:
|
| 551 |
# Need to collect more parameters
|
|
|
|
| 552 |
collection_config = cfg.global_config.llm_provider.settings.get("parameter_collection_config", {})
|
| 553 |
max_params = collection_config.get("max_params_per_question", 2)
|
| 554 |
|
|
|
|
| 624 |
return await _execute_api_call(session, intent_config)
|
| 625 |
else:
|
| 626 |
# Still need more parameters
|
|
|
|
| 627 |
collection_config = cfg.global_config.llm_provider.settings.get("parameter_collection_config", {})
|
| 628 |
max_params = collection_config.get("max_params_per_question", 2)
|
| 629 |
|