ciyidogan commited on
Commit
592ccca
·
verified ·
1 Parent(s): e5e10da

Update intent_api.py

Browse files
Files changed (1) hide show
  1. intent_api.py +7 -8
intent_api.py CHANGED
@@ -2,7 +2,6 @@ import intent_utils as intent
2
  import requests
3
  import traceback
4
  from log import log
5
- from core import llm_models
6
 
7
  def auth_token_handler(api_name, auth_config, session):
8
  try:
@@ -91,7 +90,11 @@ def refresh_auth_token(api_name, auth_config, session):
91
  def execute_intent(intent_name, user_input, session_dict, intent_definitions, data_formats, project_name, service_config):
92
  try:
93
  session = session_dict
94
- intent_def = intent_definitions[intent_name]
 
 
 
 
95
  action_api_name = intent_def.get("action")
96
 
97
  if not action_api_name:
@@ -101,11 +104,9 @@ def execute_intent(intent_name, user_input, session_dict, intent_definitions, da
101
  if not api_def:
102
  raise Exception(f"API '{action_api_name}' tanımı bulunamadı.")
103
 
104
- variables_raw = intent.extract_parameters(intent_def.get("variables", []), user_input)
105
- variables = {item["key"]: item["value"] for item in variables_raw}
106
-
107
  log(f"🚀 execute_intent('{intent_name}')")
108
- log(f"🔍 Çıkarılan parametreler: {variables}")
109
 
110
  variable_format_map = intent_def.get("variable_formats", {})
111
  is_valid, validation_errors = intent.validate_variable_formats(variables, variable_format_map, data_formats)
@@ -128,7 +129,6 @@ def execute_intent(intent_name, user_input, session_dict, intent_definitions, da
128
  verify = tls.get("verify", True)
129
  verify_path = tls.get("ca_bundle") if verify and tls.get("ca_bundle") else verify
130
 
131
- # ✅ Düzeltilmiş auth çağrısı
132
  if auth_config:
133
  token, session = auth_token_handler(action_api_name, auth_config, session)
134
  else:
@@ -178,7 +178,6 @@ def execute_intent(intent_name, user_input, session_dict, intent_definitions, da
178
  log(f"🧩 reply_template: {template}")
179
 
180
  reply = intent.resolve_placeholders(template, session, merged_variables)
181
-
182
  log(f"🛠 Final reply: {reply}")
183
 
184
  session.setdefault("variables", {}).update(merged_variables)
 
2
  import requests
3
  import traceback
4
  from log import log
 
5
 
6
  def auth_token_handler(api_name, auth_config, session):
7
  try:
 
90
  def execute_intent(intent_name, user_input, session_dict, intent_definitions, data_formats, project_name, service_config):
91
  try:
92
  session = session_dict
93
+ intent_def = intent_definitions.get(intent_name)
94
+
95
+ if not intent_def:
96
+ raise Exception(f"'{intent_name}' için intent tanımı bulunamadı.")
97
+
98
  action_api_name = intent_def.get("action")
99
 
100
  if not action_api_name:
 
104
  if not api_def:
105
  raise Exception(f"API '{action_api_name}' tanımı bulunamadı.")
106
 
107
+ variables = session.get("variables", {})
 
 
108
  log(f"🚀 execute_intent('{intent_name}')")
109
+ log(f"🔍 Kullanılan parametreler: {variables}")
110
 
111
  variable_format_map = intent_def.get("variable_formats", {})
112
  is_valid, validation_errors = intent.validate_variable_formats(variables, variable_format_map, data_formats)
 
129
  verify = tls.get("verify", True)
130
  verify_path = tls.get("ca_bundle") if verify and tls.get("ca_bundle") else verify
131
 
 
132
  if auth_config:
133
  token, session = auth_token_handler(action_api_name, auth_config, session)
134
  else:
 
178
  log(f"🧩 reply_template: {template}")
179
 
180
  reply = intent.resolve_placeholders(template, session, merged_variables)
 
181
  log(f"🛠 Final reply: {reply}")
182
 
183
  session.setdefault("variables", {}).update(merged_variables)