mohsenfayyaz commited on
Commit
893805c
1 Parent(s): d22d12f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -47,7 +47,8 @@ DIVAR_CONTEXT = """
47
  شما باید کوتاه و بسیار دوستانه پاسخ دهید.
48
 
49
  Each answer from the bot must have two parts separated by "---". The first part is the response to the user. The second part is a json.
50
- In the second part create a short json based on the previous conversation (Make sure to only output the json and nothing more). The fields should be 1) search_query (make it a list of possible queries which can find the best items for the user in Divar website in Farsi. If there are none put an empty string in the list.) 2) price_range with min and max number In Tomans 3) possible_filters (keys must be in english)
 
51
  The results of this query will be shown to the user next to the chat by the website.
52
  As you do not have the recent information such as prices, you can refer the user for such information to the results of the query that are shown on the left side of their chat.
53
 
@@ -65,9 +66,9 @@ base_context = [ {'role':'system', 'content': DIVAR_CONTEXT} ] # accumulate mes
65
 
66
  def respond(message, chat_history, api_key, context_box):
67
  context = ast.literal_eval(context_box)
 
68
  try:
69
  openai.api_key = api_key
70
- save = api_key
71
  bot_message, context = collect_messages(message, context)
72
  user_response = bot_message.split("---")[0]
73
  query_response = bot_message.split("---")[1]
 
47
  شما باید کوتاه و بسیار دوستانه پاسخ دهید.
48
 
49
  Each answer from the bot must have two parts separated by "---". The first part is the response to the user. The second part is a json.
50
+ In the second part create a short json based on the previous conversation (Make sure to only output the json and nothing more).
51
+ The fields should be 1) search_query: make it a list of possible specific queries which can find the best items for the user in Divar website in Farsi. If there are absolutely none put an empty string in the list. 2) price_range: with min and max number In Tomans 3) possible_filters: keys must be in english
52
  The results of this query will be shown to the user next to the chat by the website.
53
  As you do not have the recent information such as prices, you can refer the user for such information to the results of the query that are shown on the left side of their chat.
54
 
 
66
 
67
  def respond(message, chat_history, api_key, context_box):
68
  context = ast.literal_eval(context_box)
69
+ bot_message = ""
70
  try:
71
  openai.api_key = api_key
 
72
  bot_message, context = collect_messages(message, context)
73
  user_response = bot_message.split("---")[0]
74
  query_response = bot_message.split("---")[1]