From b86d4b7405018a09d492c1650d63f8e966e0ec1d Mon Sep 17 00:00:00 2001 From: Fabrizio Salmi Date: Thu, 27 Jun 2024 22:48:13 +0200 Subject: [PATCH] minifix: prompt (and prompt_file) can be edited via web UI --- gui.py | 16 ++++++++++++++++ setup.py | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/gui.py b/gui.py index 156a63c4..e212464c 100644 --- a/gui.py +++ b/gui.py @@ -196,6 +196,22 @@ def convert_tuple_to_list(data, keys): st.subheader("Prompt File") st.session_state.config_data['prompt_file'] = st.text_input("Prompt File Path", st.session_state.config_data.get('prompt_file', 'prompt_IT.txt')) + # Load and display prompt file content + prompt_file_path = st.session_state.config_data['prompt_file'] + if Path(prompt_file_path).exists(): + with open(prompt_file_path, 'r') as f: + prompt_content = f.read() + else: + prompt_content = "" + + st.subheader("Edit Prompt File") + new_prompt_content = st.text_area("Prompt File Content", prompt_content, height=200) + + if st.button("Save Prompt"): + with open(prompt_file_path, 'w') as f: + f.write(new_prompt_content) + st.success("Prompt file saved successfully!") + st.divider() st.subheader("RSS Retention Options") diff --git a/setup.py b/setup.py index 2b03010f..9f226cc2 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setup( name='uglypy', # The package name on PyPI - version='0.0.28', # Initial version, update manually for major changes + version='0.0.29', # Initial version, update manually for major changes author='Fabrizio Salmi', author_email='fabrizio.salmi@gmail.com', # Replace with your email description='A Python package for aggregating and processing RSS feeds with LLM-enhanced content rewriting.',