Spaces:
Sleeping
Sleeping
updated formatting
Browse files- app.py +10 -13
- semantic.py +1 -1
app.py
CHANGED
@@ -29,7 +29,7 @@ async def main(message: cl.Message):
|
|
29 |
response = _semantic_rag_chain.invoke({"question": message.content})
|
30 |
content += response["response"].content
|
31 |
except Exception as e:
|
32 |
-
|
33 |
|
34 |
# Send a response back to the user
|
35 |
await cl.Message(
|
@@ -39,20 +39,17 @@ async def main(message: cl.Message):
|
|
39 |
@cl.on_chat_start
|
40 |
async def start():
|
41 |
|
42 |
-
print("==> starting ...")
|
43 |
global _semantic_rag_chain
|
44 |
_semantic_rag_chain = SemanticRAGChainFactory.get_semantic_rag_chain()
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
print("\tsending message back: ready!!!")
|
56 |
|
57 |
content = ""
|
58 |
if _semantic_rag_chain is not None:
|
@@ -73,4 +70,4 @@ async def start():
|
|
73 |
await cl.Message(
|
74 |
content=content + "\nHow can I help you with Meta's 2023 10K?"
|
75 |
).send()
|
76 |
-
|
|
|
29 |
response = _semantic_rag_chain.invoke({"question": message.content})
|
30 |
content += response["response"].content
|
31 |
except Exception as e:
|
32 |
+
_logger.error(f"chat error: {e}: {vars(_semantic_rag_chain)}")
|
33 |
|
34 |
# Send a response back to the user
|
35 |
await cl.Message(
|
|
|
39 |
@cl.on_chat_start
|
40 |
async def start():
|
41 |
|
|
|
42 |
global _semantic_rag_chain
|
43 |
_semantic_rag_chain = SemanticRAGChainFactory.get_semantic_rag_chain()
|
44 |
|
45 |
+
await cl.Avatar(
|
46 |
+
name="Chatbot",
|
47 |
+
url="https://cdn-icons-png.flaticon.com/512/8649/8649595.png"
|
48 |
+
).send()
|
49 |
+
await cl.Avatar(
|
50 |
+
name="User",
|
51 |
+
url="https://media.architecturaldigest.com/photos/5f241de2c850b2a36b415024/master/w_1600%2Cc_limit/Luke-logo.png"
|
52 |
+
).send()
|
|
|
|
|
53 |
|
54 |
content = ""
|
55 |
if _semantic_rag_chain is not None:
|
|
|
70 |
await cl.Message(
|
71 |
content=content + "\nHow can I help you with Meta's 2023 10K?"
|
72 |
).send()
|
73 |
+
_logger.info(f"{20 * '*'}")
|
semantic.py
CHANGED
@@ -138,7 +138,7 @@ class SemanticStoreFactory:
|
|
138 |
cls._semantic_vectorstore = cls.__create_semantic_store()
|
139 |
_logger.info(f"received semantic_vectorstore")
|
140 |
else:
|
141 |
-
|
142 |
try:
|
143 |
# first try to load the store
|
144 |
cls._semantic_vectorstore = cls.__load_semantic_store()
|
|
|
138 |
cls._semantic_vectorstore = cls.__create_semantic_store()
|
139 |
_logger.info(f"received semantic_vectorstore")
|
140 |
else:
|
141 |
+
_logger.info(f"Loading semantic vectorstore {META_SEMANTIC_COLLECTION} from: {VECTOR_STORE_PATH}")
|
142 |
try:
|
143 |
# first try to load the store
|
144 |
cls._semantic_vectorstore = cls.__load_semantic_store()
|