ArunAIML commited on
Commit
71096b5
·
verified ·
1 Parent(s): 3e48917

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -12
app.py CHANGED
@@ -32,18 +32,27 @@ def get_user_data(prompt: str):
32
 
33
  def get_history(history):
34
  mod_history = []
35
- print(history)
36
- for i in history:
37
- d = {}
38
- d["role"] = i["role"]
39
- d["content"] = [
40
- {
41
- "type": "text",
42
- "text": i["content"]
43
- }
44
- ]
45
- mod_history.append(d)
46
- return mod_history
 
 
 
 
 
 
 
 
 
47
 
48
  def chat(prompt, history):
49
 
 
32
 
33
  def get_history(history):
34
  mod_history = []
35
+ for user_message, bot_message in history:
36
+ user_dict = {
37
+ "role": "user",
38
+ "content": [
39
+ {
40
+ "type": "text",
41
+ "text": user_message
42
+ }
43
+ ]
44
+ }
45
+ bot_dict = {
46
+ "role": "assistant",
47
+ "content": [
48
+ {
49
+ "type": "text",
50
+ "text": bot_message
51
+ }
52
+ ]
53
+ }
54
+ mod_history.append(user_dict)
55
+ mod_history.append(bot_dict)
56
 
57
  def chat(prompt, history):
58