Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
ubi integration
Browse files
pages/Semantic_Search.py
CHANGED
|
@@ -102,7 +102,10 @@ if 'user_id' in st.session_state:
|
|
| 102 |
|
| 103 |
|
| 104 |
if 'session_id' not in st.session_state:
|
| 105 |
-
st.session_state['session_id'] = ""
|
|
|
|
|
|
|
|
|
|
| 106 |
|
| 107 |
if 'input_reranker' not in st.session_state:
|
| 108 |
st.session_state['input_reranker'] = "None"#"Cross Encoder"
|
|
@@ -922,7 +925,7 @@ def write_chat_message(md, q,index):
|
|
| 922 |
res = json.loads(md['answer']['body'])
|
| 923 |
else:
|
| 924 |
res = md['answer']
|
| 925 |
-
st.session_state['session_id'] = "1234"
|
| 926 |
chat = st.container()
|
| 927 |
with chat:
|
| 928 |
render_answer(res,index)
|
|
|
|
| 102 |
|
| 103 |
|
| 104 |
if 'session_id' not in st.session_state:
|
| 105 |
+
st.session_state['session_id'] = f"sess_{uuid.uuid4()}"
|
| 106 |
+
|
| 107 |
+
if 'query_id' not in st.session_state:
|
| 108 |
+
st.session_state["query_id"] =""
|
| 109 |
|
| 110 |
if 'input_reranker' not in st.session_state:
|
| 111 |
st.session_state['input_reranker'] = "None"#"Cross Encoder"
|
|
|
|
| 925 |
res = json.loads(md['answer']['body'])
|
| 926 |
else:
|
| 927 |
res = md['answer']
|
| 928 |
+
#st.session_state['session_id'] = "1234"
|
| 929 |
chat = st.container()
|
| 930 |
with chat:
|
| 931 |
render_answer(res,index)
|
semantic_search/all_search_execute.py
CHANGED
|
@@ -518,8 +518,10 @@ def handler(input_,session_id):
|
|
| 518 |
dup.append(doc['_source']['image_url'])
|
| 519 |
|
| 520 |
########### ubi lambda call for query logging ###########
|
|
|
|
| 521 |
query_payload = {
|
| 522 |
-
"
|
|
|
|
| 523 |
"application": "Semantic Search",
|
| 524 |
"query_response_hit_ids": doc_ids,
|
| 525 |
"timestamp": datetime.utcnow().isoformat() + "Z",
|
|
|
|
| 518 |
dup.append(doc['_source']['image_url'])
|
| 519 |
|
| 520 |
########### ubi lambda call for query logging ###########
|
| 521 |
+
st.session_state["query_id"] = str(uuid.uuid4())
|
| 522 |
query_payload = {
|
| 523 |
+
"session_id": session_id,
|
| 524 |
+
"query_id": st.session_state["query_id"],
|
| 525 |
"application": "Semantic Search",
|
| 526 |
"query_response_hit_ids": doc_ids,
|
| 527 |
"timestamp": datetime.utcnow().isoformat() + "Z",
|