Skip to content

Commit e07de2e

Browse files
committed
try fix webbrowser again
1 parent fec3246 commit e07de2e

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

kcpp_docs.embd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1463,7 +1463,7 @@
14631463
},
14641464
"voice": {
14651465
"type": "string",
1466-
"description": "The voice to use when generating the audio. You can enter anything you like, a qunique speaker will be generated."
1466+
"description": "The voice to use when generating the audio. You can enter anything you like, a unique speaker will be generated. There are a few preset voices you can use: kobo,cheery,sleepy,tutor,shouty,bored,record"
14671467
}
14681468
},
14691469
"type": "object"

koboldcpp.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,18 +1845,18 @@ def transform_genparams(genparams, api_format):
18451845

18461846
def LaunchWebbrowser(target_url, failedmsg):
18471847
try:
1848-
import webbrowser as wb
1849-
if wb.open(target_url, autoraise=True):
1850-
return # If successful, exit the function
1851-
raise RuntimeError("wb.open failed, using fallback")
1848+
if os.name == "posix" and "DISPLAY" in os.environ: # UNIX-like systems
1849+
import subprocess
1850+
result = subprocess.run(["xdg-open", target_url], check=True)
1851+
if result.returncode == 0:
1852+
return # fallback successful
1853+
raise RuntimeError("no xdg-open")
18521854
except Exception:
18531855
try:
1854-
if os.name == "posix" and "DISPLAY" in os.environ: # UNIX-like systems
1855-
import subprocess
1856-
result = subprocess.run(["xdg-open", target_url], check=True)
1857-
if result.returncode == 0:
1858-
return # fallback successful
1859-
raise RuntimeError("fallback failed")
1856+
import webbrowser as wb
1857+
if wb.open(target_url, autoraise=True):
1858+
return # If successful, exit the function
1859+
raise RuntimeError("wb.open failed")
18601860
except Exception:
18611861
print(failedmsg)
18621862
print(f"Please manually open your browser to {target_url}")

0 commit comments

Comments
 (0)