Kushwanth Chowday Kandala commited on
Commit
909aec0
1 Parent(s): 9c2d532

TypeError: 'NoneType' object is not callable bug test

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -87,13 +87,16 @@ def chat_actions():
87
  query_vector = query_embedding.tolist()
88
  # now query vector database
89
  result = index.query(query_vector, top_k=5, include_metadata=True) # xc is a list of tuples
90
-
91
- st.session_state["chat_history"].append(
92
- {
93
- "role": "assistant",
94
- "content": result,
95
- }, # This can be replaced with your chat response logic
96
- )
 
 
 
97
 
98
 
99
  if "chat_history" not in st.session_state:
 
87
  query_vector = query_embedding.tolist()
88
  # now query vector database
89
  result = index.query(query_vector, top_k=5, include_metadata=True) # xc is a list of tuples
90
+ with st.sidebar:
91
+ st.json(result)
92
+
93
+ for result in xc['matches']:
94
+ st.session_state["chat_history"].append(
95
+ {
96
+ "role": "assistant",
97
+ "content": f"{round(result['score'],2)}: {result['metadata']['text']}",
98
+ }, # This can be replaced with your chat response logic
99
+ )
100
 
101
 
102
  if "chat_history" not in st.session_state: