Spaces:
Runtime error
Runtime error
Commit
·
655be2f
1
Parent(s):
fb9cb6f
Update main.py
Browse files
main.py
CHANGED
|
@@ -29,7 +29,7 @@ import datetime
|
|
| 29 |
|
| 30 |
@cl.author_rename
|
| 31 |
def rename(orig_author: str):
|
| 32 |
-
rename_dict = {"ConversationalRetrievalChain": "💬 Assistant conversationnel", "Retriever": "Agent conversationnel", "StuffDocumentsChain": "Chaîne de documents", "LLMChain": "Agent", "ChatAnthropic": "🤖 IA"}
|
| 33 |
return rename_dict.get(orig_author, orig_author)
|
| 34 |
|
| 35 |
@cl.action_callback("download")
|
|
@@ -247,7 +247,7 @@ async def main(message: cl.Message):
|
|
| 247 |
task1 = cl.Task(title="Connexion à la base documentaire, en attente...", status=cl.TaskStatus.RUNNING)
|
| 248 |
await pineconeRetriever.add_task(task1)
|
| 249 |
await pineconeRetriever.send()
|
| 250 |
-
message_id1 = await cl.Message(content="Connexion en cours").send()
|
| 251 |
task1.forId = message_id1
|
| 252 |
index_name = os.environ['PINECONE_INDEX_NAME']
|
| 253 |
pinecone.init(
|
|
@@ -259,7 +259,7 @@ async def main(message: cl.Message):
|
|
| 259 |
task2 = cl.Task(title="Recherche sémantique par cosine similarity, en attente...", status=cl.TaskStatus.RUNNING)
|
| 260 |
await pineconeRetriever.add_task(task2)
|
| 261 |
await pineconeRetriever.send()
|
| 262 |
-
message_id2 = await cl.Message(content="Recherche sémantique en cours").send()
|
| 263 |
task2.forId = message_id2
|
| 264 |
docsearch = Pinecone.from_existing_index(index_name, embeddings)
|
| 265 |
retrieve = docsearch.similarity_search(message.content, k=40, filter={'categorie': {'$eq': 'OF'}})
|
|
@@ -267,7 +267,7 @@ async def main(message: cl.Message):
|
|
| 267 |
task3 = cl.Task(title="Création du contexte documentaire, en attente...", status=cl.TaskStatus.RUNNING)
|
| 268 |
await pineconeRetriever.add_task(task3)
|
| 269 |
await pineconeRetriever.send()
|
| 270 |
-
message_id3 = await cl.Message(content="Création du contexte en cours").send()
|
| 271 |
task3.forId = message_id3
|
| 272 |
context = ''
|
| 273 |
metadatas = ''
|
|
|
|
| 29 |
|
| 30 |
@cl.author_rename
|
| 31 |
def rename(orig_author: str):
|
| 32 |
+
rename_dict = {"Datapcc Chain": "⏳⏳⏳", "ConversationalRetrievalChain": "💬 Assistant conversationnel", "Retriever": "Agent conversationnel", "StuffDocumentsChain": "Chaîne de documents", "LLMChain": "Agent", "ChatAnthropic": "🤖 IA"}
|
| 33 |
return rename_dict.get(orig_author, orig_author)
|
| 34 |
|
| 35 |
@cl.action_callback("download")
|
|
|
|
| 247 |
task1 = cl.Task(title="Connexion à la base documentaire, en attente...", status=cl.TaskStatus.RUNNING)
|
| 248 |
await pineconeRetriever.add_task(task1)
|
| 249 |
await pineconeRetriever.send()
|
| 250 |
+
message_id1 = await cl.Message(content="🕛 Connexion en cours").send()
|
| 251 |
task1.forId = message_id1
|
| 252 |
index_name = os.environ['PINECONE_INDEX_NAME']
|
| 253 |
pinecone.init(
|
|
|
|
| 259 |
task2 = cl.Task(title="Recherche sémantique par cosine similarity, en attente...", status=cl.TaskStatus.RUNNING)
|
| 260 |
await pineconeRetriever.add_task(task2)
|
| 261 |
await pineconeRetriever.send()
|
| 262 |
+
message_id2 = await cl.Message(content="🕧 Recherche sémantique en cours").send()
|
| 263 |
task2.forId = message_id2
|
| 264 |
docsearch = Pinecone.from_existing_index(index_name, embeddings)
|
| 265 |
retrieve = docsearch.similarity_search(message.content, k=40, filter={'categorie': {'$eq': 'OF'}})
|
|
|
|
| 267 |
task3 = cl.Task(title="Création du contexte documentaire, en attente...", status=cl.TaskStatus.RUNNING)
|
| 268 |
await pineconeRetriever.add_task(task3)
|
| 269 |
await pineconeRetriever.send()
|
| 270 |
+
message_id3 = await cl.Message(content="🕐 Création du contexte en cours").send()
|
| 271 |
task3.forId = message_id3
|
| 272 |
context = ''
|
| 273 |
metadatas = ''
|