Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
28c7128
Lighter install, a short last screen, and a word before the local voi…
ZLHad Nov 21, 2026
8ec7697
install.sh: no references/repos yet is the usual first install (pipef…
ZLHad Nov 21, 2026
6d6de95
bin/vh tts: a Ctrl-C during the local voice's package probe ends bin/…
ZLHad Nov 21, 2026
3c73c04
Review of #228: python3 asked for, every big first download said, the…
ZLHad Nov 21, 2026
3284d19
ci: the tts --provider check gives its project a script (with none, t…
ZLHad Nov 21, 2026
66a9781
Mirrors in one step: the installer falls back to them when the offici…
ZLHad Nov 21, 2026
f1a64af
ci: the mirrors check keeps its temp folder to itself (it took smoke_…
ZLHad Nov 21, 2026
f23d43c
install.sh: --mirror checked without an empty case (the wording check…
ZLHad Nov 21, 2026
e5865ca
settings: a locked update(patch) is the one way to write (re-read, me…
ZLHad Nov 21, 2026
40f348b
settings: set_mirror(mode, why=None) -> dict, what bin/vh settings mi…
ZLHad Nov 21, 2026
e7e347a
Studio's settings page: language, look, the default agent and this ma…
ZLHad Nov 21, 2026
2106efc
Mirrors, review of #231: read on every run (off takes out what an ear…
ZLHad Nov 21, 2026
f5cbf18
settings.py says the installer, not its file name: bin/vh runs it on …
ZLHad Nov 21, 2026
5ef1a46
Settings page, after review: the file decides what shows, a new chat …
ZLHad Nov 21, 2026
75ebc45
Studio's settings page takes API keys: kept in this computer's passwo…
ZLHad Nov 21, 2026
edefff1
Merge claude/first-run-mirrors (f5cbf18): the mirror switch takes eff…
ZLHad Nov 21, 2026
b6ba06b
Merge claude/settings-panel (edefff1) into claude/settings-keys: the …
ZLHad Nov 21, 2026
768194d
test_settings: no nested quotes in an f-string (Python before 3.12 ca…
ZLHad Nov 21, 2026
3b3c6c7
Merge branch 'claude/settings-panel' into claude/settings-keys
ZLHad Nov 21, 2026
0553060
Settings keys after review: the budget sentence says what is true, on…
ZLHad Nov 22, 2026
ee043c8
Merge main into claude/settings-panel
ZLHad Nov 22, 2026
969f38e
Merge main into claude/settings-panel
ZLHad Nov 22, 2026
b89fd5d
First-run guidance: a command that stops for a missing API Key says w…
ZLHad Nov 22, 2026
196715a
Merge commit '969f38e' into claude/settings-keys
ZLHad Nov 22, 2026
6a8214b
Merge commit '196715a' into claude/settings-first-run
ZLHad Nov 22, 2026
55aced6
Merge main into claude/settings-keys
ZLHad Nov 22, 2026
71d519a
Merge commit '55aced6' into claude/settings-first-run
ZLHad Nov 22, 2026
7d18d88
First-run guidance after review: Lyria's run ends, the line follows w…
ZLHad Nov 22, 2026
1be6015
Merge main into claude/settings-first-run
ZLHad Nov 22, 2026
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
6 changes: 6 additions & 0 deletions changes/settings-first-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
**少了 API Key 时,命令和 Studio 都用一句话说清去哪设、去哪拿、不用它还能怎么做**
- Why: 配音、对时间、出图、作曲缺 key 时,原来各说各的("set GEMINI_API_KEY (Google AI Studio → Get API key)"),只说了环境变量;Studio 里只看得到"配音结束时报了问题",人不知道片子在等什么、该去哪里补。
- 缺 key 停下的命令(`bin/vh tts` 各家、`--align gemini`、`voices audition`、`pace --align gemini`、`music --provider lyria`、`image gen`)都说同一句:哪一家、哪个 key,在 Studio 的设置 → 服务里填上(或者设环境变量),去哪拿,不用它时这台电脑上还能怎么做。能怎么做看这台电脑:Apple Silicon 上是本地配音、本地对时间;Intel Mac 上是 macOS 自带的声音;Linux 上没有本地的,就直说;作曲哪里都能在本地做;出图装了 Codex 时可以走 ChatGPT 的订阅。这句由 `tools/keys.py` 写,记进这次运行的记录,代码是新的 `no_key`,还记下 key 拿来做什么(配音、对时间、作曲、出图)。
- `bin/vh status` 和 Studio 的现状行在片子等 key 时说:"配音停下了:还没有 Gemini 的 API Key。在设置 → 服务里填上,再让 agent 接着做。"Studio 里那一行带一个按钮,点了直接到设置 → 服务。下面那句按 key 拿来做什么来说(配音的 key 说本地声音,对时间的 key 说本地对时间)。key 设上了(Studio 里或环境变量里)、后来同类的活做成了、或者后来别的命令失败了,这句就不说了。
- `music --provider lyria` 的运行现在会记下结束,不再被当成中断。
- 不花钱:检查在调用之前,什么都没调就停。
4 changes: 3 additions & 1 deletion tools/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def event(project, kind, **fields):

# ---------- reading ----------

_STR = ("run", "cmd", "cwd", "summary", "unit", "parent", "file", "round", "level", "code", "kept", "project")
_STR = ("run", "cmd", "cwd", "summary", "unit", "parent", "file", "round", "level", "code", "kept", "project", "need")
_INT = ("pid", "exit", "decisions")
_NUM = ("duration", "done", "total", "pass", "passes")

Expand Down Expand Up @@ -543,6 +543,8 @@ def runs(records, now=None, same_process=True):
run["summary"] = r["summary"]
elif ev == "note" and r.get("level") == "error":
run["error"] = {"code": r.get("code") or "failed", "message": r.get("summary") or ""}
if r.get("code") == "no_key": # what the key was for (voice, timing, music, image) and its names (tools/keys.py)
run["error"].update(need=r.get("need"), keys=[k for k in r.get("keys") or [] if isinstance(k, str)] if isinstance(r.get("keys"), list) else [])
elif ev == "note":
if r.get("summary"):
run["summary"] = r["summary"]
Expand Down
2 changes: 1 addition & 1 deletion tools/assets/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ def cmd_gen(a):
return 0
if a.provider == "gemini":
if not a.offline and not keys.get("GEMINI_API_KEY"):
raise Usage("set GEMINI_API_KEY (Google AI Studio → Get API key), or save it in Studio's settings (Services)")
raise Usage(keys.stopping("GEMINI_API_KEY", "image"))
if not plan["budget"]["ok"]:
raise Failed(f"{plan['budget']['message']} (bin/vh image gen --dry-run shows the estimate)")
if refs:
Expand Down
5 changes: 3 additions & 2 deletions tools/audio/lyria.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def cmd_gen(a):
say(" nothing called (--dry-run)")
return 0
if not a.offline and not keys.get("GEMINI_API_KEY"):
raise Usage("set GEMINI_API_KEY (Google AI Studio → Get API key), or save it in Studio's settings (Services)")
raise Usage(keys.stopping("GEMINI_API_KEY", "music"))
if not chk["ok"]:
raise Failed(f"{chk['message']} (--dry-run shows the price)")
folder = project / GENMUSIC / cid
Expand Down Expand Up @@ -255,7 +255,8 @@ def main(argv):


if __name__ == "__main__":
import activity # bin/vh exec's into this (cmd_music): this process writes the run's end, or the run reads as cut off
try:
sys.exit(main(sys.argv[1:]))
sys.exit(activity.exiting(lambda: main(sys.argv[1:])))
except BrokenPipeError:
sys.exit(0)
4 changes: 2 additions & 2 deletions tools/audio/pace.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ def captions(old, skip_lint=False):
f" --resume first, or pass --align gemini|whisper here to transcribe the take")
if (missing and not found) or (a.align != "map" and not a.dry_run): # before anything is written
if a.align == "gemini" and not tts.keys.get("GEMINI_API_KEY"):
sys.exit("set GEMINI_API_KEY (Google AI Studio → Get API key) for --align gemini; nothing was written")
sys.exit(tts.keys.stopping("GEMINI_API_KEY", "timing", "--align gemini needs it; nothing was written", align="--align whisper"))
if a.align == "whisper" and importlib.util.find_spec("mlx_whisper") is None:
sys.exit("--align whisper needs mlx-whisper (Apple Silicon; bin/vh pace adds it with --align whisper); nothing was written")
if missing: # the take's own word times, transcribed once and kept beside it
Expand Down Expand Up @@ -759,7 +759,7 @@ def save():
rc = 0
if a.align != "map":
if a.align == "gemini" and not tts.keys.get("GEMINI_API_KEY"):
sys.exit("set GEMINI_API_KEY for --align gemini: the paced take is written with mapped word times")
sys.exit(tts.keys.stopping("GEMINI_API_KEY", "timing", "--align gemini needs it; the paced take is written with mapped word times", align="--align whisper"))
try:
fresh = align_take(new, wav, a.align, a.lang, tmp, out["duration"])
except Exception as e: # quota, network: the mapped word times stay
Expand Down
27 changes: 11 additions & 16 deletions tools/audio/tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
pronunciation_dict.tone. text_normalization is on: "1953 年" is read 一千九百五十三年, so write years
as 一九五三年 in the spoken text.
"""
import argparse, base64, difflib, hashlib, json, os, platform, re, shutil, signal, subprocess, sys, tempfile, time, unicodedata
import argparse, base64, difflib, hashlib, json, os, re, shutil, signal, subprocess, sys, tempfile, time, unicodedata
import urllib.error, urllib.parse, urllib.request, wave
from concurrent.futures import Future, ThreadPoolExecutor
from pathlib import Path
Expand Down Expand Up @@ -218,7 +218,7 @@ def gemini_call(path, body=None, method=None, query=None, timeout=180, tries=3):
so does one asking for more than 90 s. The delay and the quota are read from the first 8 KB of the body: a long quota
message puts "retry in Ns" past the first 500 bytes, which are all that the error message repeats. A call that fails
for good raises GeminiError."""
key = keys.get("GEMINI_API_KEY") or sys.exit("set GEMINI_API_KEY (Google AI Studio → Get API key)")
key = keys.get("GEMINI_API_KEY") or sys.exit(keys.stopping("GEMINI_API_KEY"))
url = f"{GEMINI_API}/{path}" + (f"?{urllib.parse.urlencode(query, doseq=True)}" if query else "")
data = None if body is None else json.dumps(body).encode()
k = limited = 0
Expand Down Expand Up @@ -250,17 +250,13 @@ def gemini_call(path, body=None, method=None, query=None, timeout=180, tries=3):

# ---------- providers: each writes a WAV at `out` and may return word/char timings ----------

KEY_OF = {"gemini": "GEMINI_API_KEY (Google AI Studio → Get API key)", "gemini-lite": "GEMINI_API_KEY (Google AI Studio → Get API key)",
"minimax": "MINIMAX_TOKEN_PLAN_KEY (Token Plan) or MINIMAX_API_KEY (pay-as-you-go), from platform.minimax.io",
"elevenlabs": "ELEVENLABS_API_KEY (elevenlabs.io)", "dashscope": "DASHSCOPE_API_KEY (Alibaba Cloud Model Studio, 阿里云百炼)"}
KEY_OF = {"gemini": ["GEMINI_API_KEY"], "gemini-lite": ["GEMINI_API_KEY"], "minimax": ["MINIMAX_TOKEN_PLAN_KEY", "MINIMAX_API_KEY"], # Token Plan first
"elevenlabs": ["ELEVENLABS_API_KEY"], "dashscope": ["DASHSCOPE_API_KEY"]}

def no_key(provider):
"""Exit (1) on a provider with no key: the key it needs, and what works with none on this machine."""
if sys.platform == "darwin" and platform.machine() == "arm64":
free = "the local default needs no key: leave the provider out, bin/vh tts <project> (qwen, free, about " + firstuse.gb(firstuse.total(["qwen"])) + " on first use)"
else:
free = "the local default (qwen) needs no key but only runs on Apple Silicon; here --provider edge needs none (free, online)"
sys.exit(f"set {KEY_OF[provider]} for {provider}; {free}")
"""Exit (1) on a provider with no key: tools/keys.py's sentence (where to set it, where to get one), and what works with
none on this machine; on the run's record as no_key."""
sys.exit(keys.stopping(KEY_OF[provider], "voice", size=firstuse.gb(firstuse.total(["qwen"])))) # (what works with none: per platform, tools/keys.py)

def hf_cached(model_id):
"""The model is on this machine: a local folder, or a snapshot in the Hugging Face cache, found where the Hub itself
Expand Down Expand Up @@ -1122,10 +1118,9 @@ def audition(a):
if a.align == "local":
need_local_asr()
if (gemini or a.align == "gemini") and not keys.get("GEMINI_API_KEY"):
sys.exit("voices audition: set GEMINI_API_KEY (Google AI Studio → Get API key)"
+ (f" for --provider {a.provider}" if gemini else " for --align gemini") + "; nothing was synthesized")
sys.exit("voices audition: " + keys.stopping("GEMINI_API_KEY", "voice" if gemini else "timing", (f"--provider {a.provider}" if gemini else "--align gemini") + " needs it; nothing was synthesized"))
if a.provider == "minimax" and not minimax_key()[0]:
sys.exit("voices audition: set MINIMAX_TOKEN_PLAN_KEY or MINIMAX_API_KEY for --provider minimax; nothing was synthesized")
sys.exit("voices audition: " + keys.stopping(KEY_OF["minimax"], "voice", "nothing was synthesized"))
try:
import voicefeat
except ImportError:
Expand Down Expand Up @@ -1268,7 +1263,7 @@ def main():
if a.align == "local": # before anything is synthesized or deleted
need_local_asr()
if align and a.align != "local" and not keys.get("GEMINI_API_KEY"):
sys.exit("set GEMINI_API_KEY (Google AI Studio → Get API key): --align gemini / --join transcribe with Gemini (or --align local)")
sys.exit(keys.stopping("GEMINI_API_KEY", "timing", "--align gemini and --join transcribe time the words with Gemini"))
if man and a.provider == "minimax" and join != "none" and man.get("gap") != a.gap:
sys.exit(f"--resume: --gap was {man.get('gap')} for the run, now {a.gap}; in a joined minimax request it is part of the"
f" text: pass --gap {man.get('gap')}, or drop --resume to start over")
Expand All @@ -1287,7 +1282,7 @@ def linked(texts): # one minimax request: the lines linked by a pause mark of
blocks.append([s])
wavs = [f"{i+1:02d}.wav" for i in range(len(segs))] if join == "none" else [f"_block{i+1:02d}.wav" for i in range(len(blocks))]
voiced = a.resume and all((vo / f).exists() and ((vo / f).with_suffix(".words.json").exists() or not timed) for f in wavs) # the synthesis loops' own test
if not voiced and a.provider in ("elevenlabs", "dashscope", "gemini", "gemini-lite") and not keys.get(KEY_OF[a.provider].split()[0]):
if not voiced and a.provider in ("elevenlabs", "dashscope", "gemini", "gemini-lite") and not keys.get(KEY_OF[a.provider][0]):
no_key(a.provider) # before anything is synthesized or deleted; --resume with all voiced needs none
if a.provider == "minimax":
minimax_settings() # a value out of range exits here, not mid-run
Expand Down
Loading
Loading