sibthinon commited on
Commit
cddab55
·
verified ·
1 Parent(s): 918bf37

add raw query

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -47,7 +47,7 @@ model_config = {
47
  }
48
 
49
  # Global memory to hold feedback state
50
- latest_query_result = {"query": "", "result": "", "model": ""}
51
 
52
  symspell = SymSpell(max_dictionary_edit_distance=2)
53
  symspell.load_pickle("symspell_fast.pkl")
@@ -86,6 +86,7 @@ def search_product(query, model_name):
86
  return "❌ ไม่พบโมเดล"
87
 
88
  # ✨ แทรกขั้นตอน fuzzy correction
 
89
  corrected_query = correct_query_with_symspell(query)
90
 
91
  query_embed = model_config[model_name]["func"](corrected_query)
@@ -130,6 +131,7 @@ def log_feedback(feedback):
130
  now = datetime.now().strftime("%Y-%m-%d")
131
  table.create({
132
  "timestamp": now,
 
133
  "model": latest_query_result["model"],
134
  "query": latest_query_result["query"],
135
  "result": latest_query_result["result"],
 
47
  }
48
 
49
  # Global memory to hold feedback state
50
+ latest_query_result = {"query": "", "result": "", "model": "", "raw_query":""}
51
 
52
  symspell = SymSpell(max_dictionary_edit_distance=2)
53
  symspell.load_pickle("symspell_fast.pkl")
 
86
  return "❌ ไม่พบโมเดล"
87
 
88
  # ✨ แทรกขั้นตอน fuzzy correction
89
+ latest_query_result["raw_query"] = query
90
  corrected_query = correct_query_with_symspell(query)
91
 
92
  query_embed = model_config[model_name]["func"](corrected_query)
 
131
  now = datetime.now().strftime("%Y-%m-%d")
132
  table.create({
133
  "timestamp": now,
134
+ "raw_query": latest_query_result["raw_query"],
135
  "model": latest_query_result["model"],
136
  "query": latest_query_result["query"],
137
  "result": latest_query_result["result"],