datacipen commited on
Commit
f0c887a
·
verified ·
1 Parent(s): 4bd86dc

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +9 -12
main.py CHANGED
@@ -82,7 +82,7 @@ async def Affichage_reponse(response):
82
  return msg
83
 
84
  @cl.step(type="tool", show_input=True)
85
- async def Affichage_question_contexte(answer):
86
  try:
87
  indexDeb = answer.index("Question en relation avec le sujet")
88
  indexDebLength = len("Question en relation avec le sujet")
@@ -98,14 +98,12 @@ async def Affichage_question_contexte(answer):
98
  cl.Action(name="Activer", value=extraction + "?", description="Activer la question en relation avec le contexte.")
99
  ]
100
  await cl.Message(author="COPILOT", content="🌐 Question en relation avec le contexte : " + extraction + "?", actions=actions).send()
101
-
102
- @cl.step(type="tool", show_input=True)
103
- async def Affichage_recherche_web(answer):
104
- actions = [
105
- cl.Action(name="Site web", value=answer, description="Rechercher sur le site web de l'université.")
106
  ]
107
- await cl.Message(author="COPILOT", content="🌐 Rechercher sur le site web de l'université : " + answer, actions=actions).send()
108
-
109
  @cl.action_callback("Activer")
110
  async def on_action(action):
111
  client = cl.user_session.get("client")
@@ -118,7 +116,7 @@ async def on_action(action):
118
 
119
  answer = msg.content
120
 
121
- await Affichage_question_contexte(answer)
122
 
123
  @cl.action_callback("Site web")
124
  async def on_action(action):
@@ -133,7 +131,7 @@ async def on_action(action):
133
 
134
  answer = msg.content
135
 
136
- await Affichage_question_contexte(answer)
137
 
138
 
139
  @cl.set_chat_profiles
@@ -198,8 +196,7 @@ async def main(message: cl.Message):
198
  msg = await Affichage_reponse(response)
199
 
200
  answer = msg.content
201
- await Affichage_question_contexte(answer)
202
- await Affichage_recherche_web(message.content)
203
 
204
  @cl.on_stop
205
  def on_stop():
 
82
  return msg
83
 
84
  @cl.step(type="tool", show_input=True)
85
+ async def Affichage_question_contexte(answer, question):
86
  try:
87
  indexDeb = answer.index("Question en relation avec le sujet")
88
  indexDebLength = len("Question en relation avec le sujet")
 
98
  cl.Action(name="Activer", value=extraction + "?", description="Activer la question en relation avec le contexte.")
99
  ]
100
  await cl.Message(author="COPILOT", content="🌐 Question en relation avec le contexte : " + extraction + "?", actions=actions).send()
101
+
102
+ actionsWeb = [
103
+ cl.Action(name="Site web", value=question, description="Rechercher sur le site web de l'université.")
 
 
104
  ]
105
+ await cl.Message(author="COPILOT", content="🌐 Rechercher sur le site web de l'université : " + question, actions=actionsWeb).send()
106
+
107
  @cl.action_callback("Activer")
108
  async def on_action(action):
109
  client = cl.user_session.get("client")
 
116
 
117
  answer = msg.content
118
 
119
+ await Affichage_question_contexte(answer, question)
120
 
121
  @cl.action_callback("Site web")
122
  async def on_action(action):
 
131
 
132
  answer = msg.content
133
 
134
+ await Affichage_question_contexte(answer, question)
135
 
136
 
137
  @cl.set_chat_profiles
 
196
  msg = await Affichage_reponse(response)
197
 
198
  answer = msg.content
199
+ await Affichage_question_contexte(answer, message.content)
 
200
 
201
  @cl.on_stop
202
  def on_stop():