Spaces:
Building
Building
Update chat_handler.py
Browse files- chat_handler.py +3 -2
chat_handler.py
CHANGED
@@ -15,12 +15,13 @@ async def handle_chat(msg: Message, request: Request, app, service_config, sessi
|
|
15 |
|
16 |
project_name = session.project_name
|
17 |
project_config = service_config.get_project_llm_config(project_name)
|
|
|
18 |
|
19 |
# Chat history'ye user mesajını ekle
|
20 |
session.chat_history.append({"role": "user", "content": user_input})
|
21 |
|
22 |
# === LLM çağrısı
|
23 |
-
llm_response = await llm_model.generate_response_with_messages(session.chat_history, project_config)
|
24 |
log(f"🤖 LLM cevabı: {llm_response}")
|
25 |
|
26 |
# === LLM cevabını parse et
|
@@ -54,7 +55,7 @@ async def handle_chat(msg: Message, request: Request, app, service_config, sessi
|
|
54 |
data_formats = service_config.data_formats
|
55 |
|
56 |
# Parametreleri validasyonla kontrol et (backend güvenlik katmanı)
|
57 |
-
variable_format_map = intent_definitions
|
58 |
is_valid, validation_errors = validate_variable_formats(session.variables, variable_format_map, data_formats)
|
59 |
|
60 |
if not is_valid:
|
|
|
15 |
|
16 |
project_name = session.project_name
|
17 |
project_config = service_config.get_project_llm_config(project_name)
|
18 |
+
system_prompt = service_config.system_prompt # 👉 system_prompt buradan alınıyor
|
19 |
|
20 |
# Chat history'ye user mesajını ekle
|
21 |
session.chat_history.append({"role": "user", "content": user_input})
|
22 |
|
23 |
# === LLM çağrısı
|
24 |
+
llm_response = await llm_model.generate_response_with_messages(session.chat_history, project_config, system_prompt)
|
25 |
log(f"🤖 LLM cevabı: {llm_response}")
|
26 |
|
27 |
# === LLM cevabını parse et
|
|
|
55 |
data_formats = service_config.data_formats
|
56 |
|
57 |
# Parametreleri validasyonla kontrol et (backend güvenlik katmanı)
|
58 |
+
variable_format_map = intent_definitions.get(intent, {}).get("variable_formats", {})
|
59 |
is_valid, validation_errors = validate_variable_formats(session.variables, variable_format_map, data_formats)
|
60 |
|
61 |
if not is_valid:
|