Add experimental Lingma remote backend

This commit is contained in:
lutc5
2026-04-30 12:09:51 +08:00
parent 1c188fcf17
commit 2bcb0a6715
15 changed files with 1543 additions and 37 deletions

View File

@@ -222,7 +222,7 @@ onUnmounted(() => {
<span class="status-dot" :class="{ running: status.running }"></span>
<div>
<strong>{{ status.running ? 'Proxy Running' : 'Proxy Stopped' }}</strong>
<small>v1.3.2</small>
<small>v1.4.0</small>
</div>
</div>
</aside>

View File

@@ -9,6 +9,10 @@ const saving = ref(false)
const openSelect = ref('')
const selectOptions = {
Backend: [
{ value: 'ipc', label: 'IPC 插件' },
{ value: 'remote', label: '远端 API' },
],
Transport: [
{ value: 'auto', label: '自动' },
{ value: 'pipe', label: '命名管道' },
@@ -88,6 +92,26 @@ async function save() {
</div>
</div>
<div class="form-grid">
<div class="field">
<label>连接模式</label>
<div class="custom-select" :class="{ open: openSelect === 'Backend' }">
<button type="button" @click="toggleSelect('Backend')">
<span>{{ selectLabel('Backend') }}</span>
<i class="bi bi-chevron-down" aria-hidden="true"></i>
</button>
<div v-if="openSelect === 'Backend'" class="select-menu">
<button
v-for="option in selectOptions.Backend"
:key="option.value"
:class="{ selected: option.value === config.Backend }"
type="button"
@click="chooseOption('Backend', option.value)"
>
{{ option.label }}
</button>
</div>
</div>
</div>
<div class="field">
<label>主机</label>
<input v-model="config.Host" type="text" placeholder="127.0.0.1" />
@@ -128,10 +152,22 @@ async function save() {
<label>命名管道</label>
<input v-model="config.Pipe" type="text" placeholder="留空自动探测 Windows Named Pipe" />
</div>
<div class="field span-2">
<label>远端 API 域名</label>
<input v-model="config.RemoteBaseURL" type="text" placeholder="留空自动探测,默认 https://lingma.alibabacloud.com" />
</div>
<div class="field span-2">
<label>远端认证文件</label>
<input v-model="config.RemoteAuthFile" type="text" placeholder="可选 credentials.json留空只读 ~/.lingma/cache/user" />
</div>
<div class="field span-2">
<label>远端 Cosy 版本</label>
<input v-model="config.RemoteVersion" type="text" placeholder="默认 2.11.2" />
</div>
</div>
<div class="hint-box">
<strong>自动探测失败时</strong>
<span>先确认 VS Code / Lingma 插件已启动并登录macOS 通常填写 WebSocket例如 <code>ws://127.0.0.1:36510/</code>Windows 可填写命名管道,例如 <code>\\.\pipe\lingma-xxxx</code>,也可填写 WebSocket例如 <code>ws://127.0.0.1:36510/</code>。</span>
<span>IPC 模式先确认 VS Code / Lingma 插件已启动并登录远端 API 模式会优先读取认证文件留空时只读 <code>~/.lingma/cache/user</code></span>
</div>
</div>

View File

@@ -66,9 +66,13 @@ export namespace service {
export class Config {
Host: string;
Port: number;
Backend: string;
Transport: string;
Pipe: string;
WebSocketURL: string;
RemoteBaseURL: string;
RemoteAuthFile: string;
RemoteVersion: string;
Cwd: string;
CurrentFilePath: string;
Mode: string;
@@ -85,9 +89,13 @@ export namespace service {
if ('string' === typeof source) source = JSON.parse(source);
this.Host = source["Host"];
this.Port = source["Port"];
this.Backend = source["Backend"];
this.Transport = source["Transport"];
this.Pipe = source["Pipe"];
this.WebSocketURL = source["WebSocketURL"];
this.RemoteBaseURL = source["RemoteBaseURL"];
this.RemoteAuthFile = source["RemoteAuthFile"];
this.RemoteVersion = source["RemoteVersion"];
this.Cwd = source["Cwd"];
this.CurrentFilePath = source["CurrentFilePath"];
this.Mode = source["Mode"];