Skip to content

Commit 03df388

Browse files
committed
update comment
1 parent 535a020 commit 03df388

File tree

6 files changed

+5
-25
lines changed

6 files changed

+5
-25
lines changed

application/pages/1_🌍_Generative_BI_Playground.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,7 @@ def main():
384384
"intent": "normal_search",
385385
"slot": []
386386
}
387-
# 通过标志位控制后续的逻辑
388-
# 主要的意图有4个, 拒绝, 查询, 思维链, 知识问答
387+
389388
if intent_ner_recognition_flag:
390389
with st.status("Performing intent recognition...") as status_text:
391390
intent_response = get_query_intent(model_type, search_box, prompt_map)
@@ -413,12 +412,10 @@ def main():
413412
else:
414413
search_intent_flag = True
415414

416-
# 主要的逻辑部分,调用LLM
417415
if reject_intent_flag:
418416
st.write("Your query statement is currently not supported by the system")
419417

420418
elif search_intent_flag:
421-
# 执行普通的查询,并可视化结果
422419
normal_search_result = normal_text_search_streamlit(search_box, model_type,
423420
database_profile,
424421
entity_slot, opensearch_info,
@@ -456,11 +453,9 @@ def main():
456453
else:
457454
st.error("Intent recognition error")
458455

459-
# 前端结果显示agent cot任务拆分信息, normal_text_search 的显示,做了拆分,为了方便跟API逻辑一致
460456
if search_intent_flag:
461457
if normal_search_result.sql != "":
462458
current_nlq_chain.set_generated_sql(normal_search_result.sql)
463-
# st.code(normal_search_result.sql, language="sql")
464459

465460
current_nlq_chain.set_generated_sql_response(normal_search_result.response)
466461

@@ -478,7 +473,6 @@ def main():
478473
with st.expander(f'Agent Task Result: {len(agent_search_result)}'):
479474
st.write(agent_search_result)
480475

481-
# 连接数据库,执行SQL, 记录历史记录并展示
482476
if search_intent_flag:
483477
with st.spinner('Executing query...'):
484478
search_intent_result = get_sql_result_tool(
@@ -544,18 +538,16 @@ def main():
544538
# do something here
545539
pass
546540

547-
# 数据可视化展示
548541
if visualize_results_flag and search_intent_flag:
549542
current_search_sql_result = st.session_state.current_sql_result[selected_profile]
550543
if current_search_sql_result is not None and len(current_search_sql_result) > 0:
551544
st.session_state.messages[selected_profile].append(
552545
{"role": "assistant", "content": current_search_sql_result, "type": "pandas"})
553-
# Reset change flag to False
546+
554547
do_visualize_results(current_nlq_chain, st.session_state.current_sql_result[selected_profile])
555548
else:
556549
st.markdown("No relevant data found")
557550

558-
# 生成推荐问题
559551
if gen_suggested_question_flag and (search_intent_flag or agent_intent_flag):
560552
st.markdown('You might want to further ask:')
561553
with st.spinner('Generating suggested questions...'):
@@ -576,7 +568,7 @@ def main():
576568
on_click=sample_question_clicked,
577569
args=[gen_sq_list[2]])
578570
else:
579-
# st.error("Please enter a valid query.")
571+
580572
if current_nlq_chain.is_visualization_config_changed():
581573
if visualize_results_flag:
582574
do_visualize_results(current_nlq_chain, st.session_state.current_sql_result[selected_profile])

application/pages/2_🪙_Data_Connection_Management.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,6 @@ def main():
112112
ConnectionManagement.delete_connection(connection_name)
113113
st.success(f"{connection_name} deleted successfully!")
114114
st.session_state.current_connection = None
115-
# st.session_state.update_connection_mode = False
116-
# st.experimental_rerun() # Rerun the app to update the selectbox options and remove the selected option
117115

118116
st.session_state.update_connection_mode = False
119117

application/pages/3_🪙_Data_Profile_Management.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ def main():
111111
st.session_state.profile_page_mode = 'default'
112112

113113
else:
114-
# st.subheader("Data Profile Management")
115114
st.info('Please select connection in the left sidebar.')
116115

117116

application/pages/4_🪙_Schema_Description_Management.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ def main():
1212
st.set_page_config(page_title="Schema Management", )
1313
make_sidebar()
1414

15-
# if 'profile_page_mode' not in st.session_state:
16-
# st.session_state['index_mgt_mode'] = 'default'
17-
1815
with st.sidebar:
1916
st.title("Schema Management")
2017
current_profile = st.selectbox("My Data Profiles", ProfileManagement.get_all_profiles(),

application/pages/mainpage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
st.info("The OpenSearch Index is Error, Please Create OpenSearch Index First!!!")
3232
else:
3333
current_profile = "entity_insert_test"
34-
entity = "环比"
35-
comment = "环比增长率是指本期和上期相比较的增长率,计算公式为:环比增长率 =(本期数-上期数)/ 上期数 ×100%"
34+
entity = "Month on month ratio"
35+
comment = "The month on month growth rate refers to the growth rate compared to the previous period, and the calculation formula is: month on month growth rate=(current period number - previous period number)/previous period number x 100%"
3636
VectorStore.add_entity_sample(current_profile, entity, comment)

application/utils/tool.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,14 @@ def get_generated_sql(generated_sql_response):
1818

1919

2020
def generate_log_id():
21-
# 获取当前时间戳,精确到微秒
2221
timestamp = int(time.time() * 1000000)
23-
# 添加随机数以增加唯一性
2422
random_part = random.randint(0, 9999)
25-
# 拼接时间戳和随机数生成logID
2623
log_id = f"{timestamp}{random_part:04d}"
2724
return log_id
2825

2926

3027
def get_current_time():
31-
# 获取当前时间
3228
now = datetime.now()
33-
# 格式化时间,包括毫秒部分
34-
# 注意:strftime默认不直接支持毫秒,需要单独处理
3529
formatted_time = now.strftime('%Y-%m-%d %H:%M:%S')
3630
return formatted_time
3731

0 commit comments

Comments
 (0)