jhangmez commited on
Commit
2704ff2
1 Parent(s): cc7222a

Se retorno todo

Browse files
Files changed (1) hide show
  1. app.py +7 -19
app.py CHANGED
@@ -15,27 +15,15 @@ def respond(
15
  temperature,
16
  top_p,
17
  ):
18
- conversations = [
19
- {"from": "system", "value": system_message}
20
- ]
21
 
22
- for human, assistant in history:
23
- if human:
24
- conversations.append({"from": "human", "value": human})
25
- if assistant:
26
- conversations.append({"from": "gpt", "value": assistant})
27
 
28
- conversations.append({"from": "human", "value": message})
29
-
30
- # Convertir el formato de conversaciones al formato esperado por la API
31
- messages = []
32
- for conv in conversations:
33
- if conv["from"] == "system":
34
- messages.append({"role": "system", "content": conv["value"]})
35
- elif conv["from"] == "human":
36
- messages.append({"role": "user", "content": conv["value"]})
37
- elif conv["from"] == "gpt":
38
- messages.append({"role": "assistant", "content": conv["value"]})
39
 
40
  response = ""
41
 
 
15
  temperature,
16
  top_p,
17
  ):
18
+ messages = [{"role": "system", "content": system_message}]
 
 
19
 
20
+ for val in history:
21
+ if val[0]:
22
+ messages.append({"role": "user", "content": val[0]})
23
+ if val[1]:
24
+ messages.append({"role": "assistant", "content": val[1]})
25
 
26
+ messages.append({"role": "user", "content": message})
 
 
 
 
 
 
 
 
 
 
27
 
28
  response = ""
29