summaryrefslogtreecommitdiffstats
path: root/g4f/gui/webview.py
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-03-16 10:48:37 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-03-16 10:48:37 +0100
commit905ced06bd27d4a252791c2316d0bb00b8326d35 (patch)
tree223c46b0c1902ec73ea55d401eebbf01078c082d /g4f/gui/webview.py
parentMove raise_for_status, Create FormData wrapper (diff)
downloadgpt4free-905ced06bd27d4a252791c2316d0bb00b8326d35.tar
gpt4free-905ced06bd27d4a252791c2316d0bb00b8326d35.tar.gz
gpt4free-905ced06bd27d4a252791c2316d0bb00b8326d35.tar.bz2
gpt4free-905ced06bd27d4a252791c2316d0bb00b8326d35.tar.lz
gpt4free-905ced06bd27d4a252791c2316d0bb00b8326d35.tar.xz
gpt4free-905ced06bd27d4a252791c2316d0bb00b8326d35.tar.zst
gpt4free-905ced06bd27d4a252791c2316d0bb00b8326d35.zip
Diffstat (limited to 'g4f/gui/webview.py')
-rw-r--r--g4f/gui/webview.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/g4f/gui/webview.py b/g4f/gui/webview.py
index 16f143c4..a8e745f3 100644
--- a/g4f/gui/webview.py
+++ b/g4f/gui/webview.py
@@ -1,34 +1,32 @@
import webview
-from functools import partial
try:
from platformdirs import user_config_dir
has_platformdirs = True
except ImportError:
has_platformdirs = False
-from g4f.gui import run_gui
from g4f.gui.run import gui_parser
+from g4f.gui.server.api import Api
import g4f.version
import g4f.debug
def run_webview(
- host: str = "0.0.0.0",
- port: int = 8080,
debug: bool = False,
storage_path: str = None
):
webview.create_window(
f"g4f - {g4f.version.utils.current_version}",
- f"http://{host}:{port}/",
- text_select=True
+ "client/index.html",
+ text_select=True,
+ js_api=Api(),
)
if has_platformdirs and storage_path is None:
storage_path = user_config_dir("g4f-webview")
webview.start(
- partial(run_gui, host, port),
private_mode=False,
storage_path=storage_path,
- debug=debug
+ debug=debug,
+ ssl=True
)
if __name__ == "__main__":
@@ -36,4 +34,4 @@ if __name__ == "__main__":
args = parser.parse_args()
if args.debug:
g4f.debug.logging = True
- run_webview(args.host, args.port, args.debug) \ No newline at end of file
+ run_webview(args.debug) \ No newline at end of file