diff --git a/embrace_life/app.py b/embrace_life/app.py index b8a1a7f..a9724f3 100644 --- a/embrace_life/app.py +++ b/embrace_life/app.py @@ -25,8 +25,8 @@ class EmbraceLifeApp: return system_template = ( - '你是臺灣民法專家,請判斷接下來自書遺囑內容在請立囑人親筆書寫簽名後是否有效,' - '有效的話則回傳有效,無效的話請一百字內告訴我哪些內容需要修改。' + '你是臺灣民法專家,請判斷接下來自書遺囑內容在請立囑人親筆書寫簽名後是否為有效遺囑,' + '是的話則回傳沒問題,否的話請一百字內只要告訴我哪些遺內容需要修改。' ) user_template = '{input_text}' @@ -54,9 +54,9 @@ class EmbraceLifeApp: with st.expander('流程說明'): st.write(""" 1. 請填入以下所有資料 - 2. 點擊「製作」產生遺囑內容 + 2. 點擊「製作」產生遺囑草稿,建議由專業人員(律師)協助審閱 3. 準備紙筆,由立囑人親筆謄寫所有遺囑內容 - 4. 妥善保存紙本遺囑,並將保存地點告訴遺囑執行人 + 4. 請妥善保存紙本遺囑,並將保存地點告訴遺囑執行人 """) # 3) Testator Info @@ -160,22 +160,33 @@ class EmbraceLifeApp: day=datetime.now().day, ) st.code(self._will_content, language=None) - st.download_button( - label='下載', - data=self._will_content, - file_name='遺囑.txt', - mime='text/plain', - icon=':material/download:', - ) - ai_check_button = ai_check_button = st.button('AI校稿', icon=':material/search:') + col1, col2, _, _, _ = st.columns(5) + with col1: + st.download_button( + label='下載', + data=self._will_content, + file_name='遺囑.txt', + mime='text/plain', + icon=':material/download:', + ) + with col2: + ai_check_button = ai_check_button = st.button('AI審閱', icon=':material/search:') if ai_check_button: with st.spinner('校稿中...'): - result = self._chain.stream({'input_text': self._will_content}) - st.write_stream(result) + result = self._chain.invoke({'input_text': self._will_content}).content + if result == '沒問題': + st.success(result) + else: + st.info(result) else: st.warning('請填入所有資料') + # Footer + st.divider() + footer_text = f'
{self._config["app"]["page_footer_text"]}