mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-12-18 10:37:11 +00:00
Set Web Interface URL from loaded state in Desktop GUIs. Not hard-coded
This commit is contained in:
parent
7f479b0104
commit
9bc4fd539e
4 changed files with 7 additions and 3 deletions
|
@ -134,7 +134,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||||
action_bar_layout = QtWidgets.QHBoxLayout(action_bar)
|
action_bar_layout = QtWidgets.QHBoxLayout(action_bar)
|
||||||
|
|
||||||
self.configure_button = QtWidgets.QPushButton("Configure", clicked=self.configure_app)
|
self.configure_button = QtWidgets.QPushButton("Configure", clicked=self.configure_app)
|
||||||
self.search_button = QtWidgets.QPushButton("Search", clicked=lambda: webbrowser.open('http://localhost:8000/'))
|
self.search_button = QtWidgets.QPushButton("Search", clicked=lambda: webbrowser.open(f'http://{state.host}:{state.port}/'))
|
||||||
self.search_button.setEnabled(not self.first_run)
|
self.search_button.setEnabled(not self.first_run)
|
||||||
|
|
||||||
action_bar_layout.addWidget(self.configure_button)
|
action_bar_layout.addWidget(self.configure_button)
|
||||||
|
|
|
@ -5,7 +5,7 @@ import webbrowser
|
||||||
from PyQt6 import QtGui, QtWidgets
|
from PyQt6 import QtGui, QtWidgets
|
||||||
|
|
||||||
# Internal Packages
|
# Internal Packages
|
||||||
from src.utils import constants
|
from src.utils import constants, state
|
||||||
|
|
||||||
|
|
||||||
def create_system_tray(gui: QtWidgets.QApplication, main_window: QtWidgets.QMainWindow):
|
def create_system_tray(gui: QtWidgets.QApplication, main_window: QtWidgets.QMainWindow):
|
||||||
|
@ -24,7 +24,7 @@ def create_system_tray(gui: QtWidgets.QApplication, main_window: QtWidgets.QMain
|
||||||
# Create the menu and menu actions
|
# Create the menu and menu actions
|
||||||
menu = QtWidgets.QMenu()
|
menu = QtWidgets.QMenu()
|
||||||
menu_actions = [
|
menu_actions = [
|
||||||
('Search', lambda: webbrowser.open('http://localhost:8000/')),
|
('Search', lambda: webbrowser.open(f'http://{state.host}:{state.port}/')),
|
||||||
('Configure', main_window.show),
|
('Configure', main_window.show),
|
||||||
('Quit', gui.quit),
|
('Quit', gui.quit),
|
||||||
]
|
]
|
||||||
|
|
|
@ -79,6 +79,8 @@ def set_state(args):
|
||||||
state.config_file = args.config_file
|
state.config_file = args.config_file
|
||||||
state.config = args.config
|
state.config = args.config
|
||||||
state.verbose = args.verbose
|
state.verbose = args.verbose
|
||||||
|
state.host = args.host
|
||||||
|
state.port = args.port
|
||||||
|
|
||||||
|
|
||||||
def start_server(app, host=None, port=None, socket=None):
|
def start_server(app, host=None, port=None, socket=None):
|
||||||
|
|
|
@ -13,4 +13,6 @@ processor_config = ProcessorConfigModel()
|
||||||
config_file: Path = ""
|
config_file: Path = ""
|
||||||
verbose: int = 0
|
verbose: int = 0
|
||||||
device = torch.device("cuda:0") if torch.cuda.is_available() else torch.device("cpu") # Set device to GPU if available
|
device = torch.device("cuda:0") if torch.cuda.is_available() else torch.device("cpu") # Set device to GPU if available
|
||||||
|
host: str = None
|
||||||
|
port: int = None
|
||||||
cli_args = None
|
cli_args = None
|
Loading…
Reference in a new issue