1) mod system prompt for stability, 2) add warning to page footer
This commit is contained in:
@ -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'<div style="text-align:center"><p>{self._config["app"]["page_footer_text"]}</p></div>'
|
||||
st.markdown(footer_text, unsafe_allow_html=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = EmbraceLifeApp()
|
||||
|
||||
@ -2,6 +2,7 @@ app:
|
||||
page_title: 自書遺囑製作
|
||||
page_description: 這是一封重新擁抱生命的書信,也是對所愛之人的一份溫柔承諾。
|
||||
page_favicon_path: ./assets/favicon.jpg
|
||||
page_footer_text: ⚠️ 本AI工具產生之文件為遺囑草稿範本,僅供參考使用,不具法律效力,請交由專業律師審閱,並依《民法》規定之方式製作
|
||||
openai:
|
||||
model_name: gpt-4.1-mini
|
||||
max_tokens: 1024
|
||||
|
||||
Reference in New Issue
Block a user