dsh-bili-scroll
c1overzz
DSH 插件:每天替你刷一轮 B站,读字幕挑出值得的、写一份日报,值得的 @ 你
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:wjj-8283/dsh-opencode-go-proxy
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
DSH 插件:本机 OpenCode Go 反代理。dsh 启动时自动把反代理挂到 DSH 自己的
webserver 上(与 DSH 共用端口),转发到 OpenCode Go 上游(默认 https://opencode.ai),
并在发包前注入 OpenCode 要求的会话/请求头(x-opencode-session / x-opencode-request /
x-opencode-client / x-opencode-project / User-Agent)。
由仓库下的 opencode-go-proxy-win 脚本改造而来:
| 原脚本 | 本插件 |
|---|---|
opencode-go-proxy.mjs(顶层启动) |
proxy.js(导出 createForwarder / createProxy) |
opencode-go-proxy-start-minimal.bat |
插件 apply 在 dsh 启动时自动拉起 |
手动 Ctrl+C 停止 |
随 dsh 应用卸载自动关闭 |
opencode-go-proxy-plugin/
package.json name + dsh.bundle.patch + exports
cordis.patch.yml 把本插件插入宿主 Loader 条目(自动加载)
index.js 插件 apply:挂到 webserver + settings + 状态路由
proxy.js 核心反代理逻辑(从 .mjs 移植为可导入模块)
插件是一个 bundle(dsh.bundle.patch),装进某个 profile 后它会进入
dsh.profile.bundles,下次 dsh --profile <name> 启动时自动加载:
dsh plugin --profile web add /Users/wjj/repos/dsh/opencode-go-proxy-plugin
dsh plugin --profile qq add /Users/wjj/repos/dsh/opencode-go-proxy-plugin
默认 mode=webserver:把反代理挂到该 profile 的 webserver 的前缀路径下。
客户端 baseURL 指向该路径即可:
web profile:http://127.0.0.1:3080/api/opencode-proxy/v1qq profile:http://127.0.0.1:3220/api/opencode-proxy/v1
(端口取各 profile 的 webserver 端口,即 dsh web 的默认 3080、qq 默认 3220)反代理把挂载前缀 /api/opencode-proxy/v1 之后的路径映射回上游的真实 API 根:
默认 upstreamBasePath=/zen/go/v1,因此 .../api/opencode-proxy/v1/responses 会转发成
https://opencode.ai/zen/go/v1/responses。若剥离后的路径已带 upstreamBasePath 前缀则不重复叠加(幂等)。
DSH 的模型设置(llm-pi-ai.providers)里把某个 provider 的 baseURL 指向本代理即可
(把原来直连 https://opencode.ai/zen/go/v1 换成代理地址)。例如现有 oc-go(OpenCode Go):
直连:
oc-go:
displayName: OpenCode Go
apiKeyEnv: OC_GO_API_KEY
api: openai-responses
baseURL: https://opencode.ai/zen/go/v1 # 原来是直连
reasoning: high
models: [...]
走代理(以 web profile 为例):
oc-go:
displayName: OpenCode Go
apiKeyEnv: OC_GO_API_KEY
api: openai-responses
baseURL: http://127.0.0.1:3080/api/opencode-proxy/v1 # 改成代理地址
reasoning: high
models: [...]
oc-go,不影响当前默认模型(agent-default-model 还是 deepseek-official)。oc-go + 某个 model(如 muse-spark-1.2-contributor)。OC_GO_API_KEY 环境变量:代理会原样转发 Authorization 头,并在发包前注入
x-opencode-session/request/client/project、把 User-Agent 换成 opencode/...。web 改了插件源码后要重启 dsh web
才会从“旧独立 8787”切到“3080/api/opencode-proxy/v1”。若某个 profile 没有 webserver,或你想让代理跑在独立端口上,把 settings 的
mode 设为 standalone,则用 port(默认 8787)起一个独立 server:
http://127.0.0.1:8787。此时客户端 baseURL 用 http://127.0.0.1:8787。
dsh-opencode-go-proxy)enabled(默认 true):启动即拉起mode(默认 webserver):webserver(挂 DSH webserver 前缀) | standalone(独立端口)mountPath(默认 /api/opencode-proxy/v1):webserver 模式下的挂载前缀upstreamBasePath(默认 /zen/go/v1):映射回上游的真实 API 根(幂等叠加)port(默认 8787):standalone 模式下的监听端口upstreamHost(默认 opencode.ai)、upstreamProto(默认 https)opencodeUa(默认 opencode/1.18.29 cli)环境变量兜底:PROXY_PORT / UPSTREAM_HOST / UPSTREAM_PROTO / UPSTREAM_PORT /
OPENCODE_UA,仅在 settings 未设置时生效。
GET /api/opencode-proxy/status(经 profile 的 webserver)。CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: 无有效分类标签。