@@ -30,31 +30,32 @@ def main():
3030 placeholder = "Please select data profile..." , key = 'current_profile_name' )
3131
3232 tab_view , tab_add = st .tabs (['View Samples' , 'Add New Sample' ])
33-
34- with tab_view :
35- if current_profile is not None :
36- for sample in VectorStore .get_all_agent_cot_samples (current_profile ):
37- # st.write(f"Sample: {sample}")
38- with st .expander (sample ['query' ]):
39- st .code (sample ['comment' ])
40- st .button ('Delete ' + sample ['id' ], on_click = delete_entity_sample , args = [current_profile , sample ['id' ]])
41-
42- with tab_add :
43- if current_profile is not None :
44- query = st .text_input ('Query' , key = 'index_question' )
45- comment = st .text_area ('Comment' , key = 'index_answer' , height = 300 )
46-
47- if st .button ('Submit' , type = 'primary' ):
48- if len (query ) > 0 and len (comment ) > 0 :
49- VectorStore .add_agent_cot_sample (current_profile , query , comment )
50- st .success ('Sample added' )
51- time .sleep (2 )
52- # del st.session_state['index_question']
53- # del st.session_state['index_answer']
54- st .rerun ()
55- else :
56- st .error ('please input valid question and answer' )
57-
33+ if current_profile is not None :
34+ with tab_view :
35+ if current_profile is not None :
36+ for sample in VectorStore .get_all_agent_cot_samples (current_profile ):
37+ # st.write(f"Sample: {sample}")
38+ with st .expander (sample ['query' ]):
39+ st .code (sample ['comment' ])
40+ st .button ('Delete ' + sample ['id' ], on_click = delete_entity_sample , args = [current_profile , sample ['id' ]])
41+
42+ with tab_add :
43+ if current_profile is not None :
44+ query = st .text_input ('Query' , key = 'index_question' )
45+ comment = st .text_area ('Comment' , key = 'index_answer' , height = 300 )
46+
47+ if st .button ('Submit' , type = 'primary' ):
48+ if len (query ) > 0 and len (comment ) > 0 :
49+ VectorStore .add_agent_cot_sample (current_profile , query , comment )
50+ st .success ('Sample added' )
51+ time .sleep (2 )
52+ # del st.session_state['index_question']
53+ # del st.session_state['index_answer']
54+ st .rerun ()
55+ else :
56+ st .error ('please input valid question and answer' )
57+ else :
58+ st .info ('Please select data profile in the left sidebar.' )
5859
5960if __name__ == '__main__' :
6061 main ()
0 commit comments