Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LAN access configuration to settings UI #22

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions llama_index_pq/pq/prompt_quill_ui_qdrant.py
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,23 @@
prompt_template_submit_button.click(fn=ui_code.set_prompt_template,
inputs=[prompt_template_select, prompt_template, ],
outputs=[prompt_template_status])
with gr.Tab("Network Settings") as network_settings:
with gr.Row():
with gr.Column(scale=3):
enable_lan_access = gr.Checkbox(
label="Enable LAN Access",
info="Allow other computers on your network to access PromptQuill. Requires restart to take effect.",
value=g.settings_data['enable_lan_access']
)
with gr.Column(scale=1):
network_status = gr.TextArea('', label="Status", placeholder='Status')
network_save_button = gr.Button('Save Network Settings')

network_save_button.click(
fn=ui_code.set_network_settings,
inputs=[enable_lan_access],
outputs=network_status
)
gr.on(
triggers=[generator.select],
fn=ui_code.all_get_last_prompt,
Expand Down Expand Up @@ -1379,8 +1395,10 @@


if __name__ == "__main__":
server_name = "localhost"
if os.getenv("SERVER_NAME") is not None:
server_name = os.getenv("SERVER_NAME")
pq_ui.launch(favicon_path='logo/favicon32x32.ico', inbrowser=True, server_name=server_name,
server_port=49152) # share=True
server_name = "localhost"
if os.getenv("SERVER_NAME") is not None:
server_name = os.getenv("SERVER_NAME")
elif g.settings_data['enable_lan_access']:
server_name = "0.0.0.0" # Allow connections from any IP
pq_ui.launch(favicon_path='logo/favicon32x32.ico', inbrowser=True, server_name=server_name,
server_port=49152) # share=True
5 changes: 5 additions & 0 deletions llama_index_pq/pq/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,11 @@ def set_sailing_settings(self,sail_text, keep_sail_text, sail_width, sail_depth,
self.g.settings_data['sail_unload_llm'] = sail_unload_llm
self.settings_io.write_settings(self.g.settings_data)

def set_network_settings(self, enable_lan_access):
self.g.settings_data['enable_lan_access'] = enable_lan_access
self.settings_io.write_settings(self.g.settings_data)
return 'Network settings saved. Restart PromptQuill for changes to take effect.'


def set_molmo(self, molmo_folder_name,
molmo_file_renamer_prompt,
Expand Down