Update main.py
Browse files
main.py
CHANGED
@@ -50,8 +50,9 @@ def Chargement_des_datas_web(profile):
|
|
50 |
fileOpen.close()
|
51 |
return txt
|
52 |
|
53 |
-
|
54 |
-
|
|
|
55 |
return ChatCompletionsClient(
|
56 |
endpoint="https://models.inference.ai.azure.com",
|
57 |
credential=AzureKeyCredential(os.environ["GITHUB_TOKEN"]),
|
@@ -306,14 +307,14 @@ async def chat_profile():
|
|
306 |
|
307 |
@cl.on_chat_start
|
308 |
async def on_chat_start():
|
309 |
-
client = Connexion_Mistral()
|
310 |
cl.user_session.set("client", client)
|
311 |
|
312 |
@cl.on_message
|
313 |
async def main(message: cl.Message):
|
314 |
data = Chargement_des_datas(cl.user_session.get("chat_profile"))
|
315 |
cl.user_session.set("data", data)
|
316 |
-
cl.user_session.get("client")
|
317 |
|
318 |
response = Generation_reponse(client, data, message.content)
|
319 |
|
|
|
50 |
fileOpen.close()
|
51 |
return txt
|
52 |
|
53 |
+
#@cl.step(type="llm", show_input=True)
|
54 |
+
@cl.cache
|
55 |
+
asyn def Connexion_Mistral():
|
56 |
return ChatCompletionsClient(
|
57 |
endpoint="https://models.inference.ai.azure.com",
|
58 |
credential=AzureKeyCredential(os.environ["GITHUB_TOKEN"]),
|
|
|
307 |
|
308 |
@cl.on_chat_start
|
309 |
async def on_chat_start():
|
310 |
+
client = await Connexion_Mistral()
|
311 |
cl.user_session.set("client", client)
|
312 |
|
313 |
@cl.on_message
|
314 |
async def main(message: cl.Message):
|
315 |
data = Chargement_des_datas(cl.user_session.get("chat_profile"))
|
316 |
cl.user_session.set("data", data)
|
317 |
+
client = cl.user_session.get("client")
|
318 |
|
319 |
response = Generation_reponse(client, data, message.content)
|
320 |
|