feat: add Lingma IPC proxy service

This commit is contained in:
coolxll
2026-03-25 21:35:19 +08:00
commit 585c3ba5ab
8 changed files with 1614 additions and 0 deletions

87
README.md Normal file
View File

@@ -0,0 +1,87 @@
# lingma-ipc-proxy
A standalone Go backend that talks to Lingma over Windows named-pipe IPC and exposes:
- `GET /v1/models`
- `POST /v1/messages`
- `POST /v1/chat/completions`
Current scope:
- non-streaming only
- one request at a time
- Windows only
- directly uses Lingma IPC, not DOM/CDP
## Run
```powershell
cd C:\Workspace\Personal\lingma-ipc-proxy
go run .\cmd\lingma-ipc-proxy
```
## Flags
```powershell
go run .\cmd\lingma-ipc-proxy --port 8095 --session-mode auto
```
- `--host`
- `--port`
- `--pipe`
- `--cwd`
- `--current-file-path`
- `--mode`
- `--shell-type`
- `--session-mode`
- `--timeout`
## Environment
- `LINGMA_IPC_PIPE`
- `LINGMA_PROXY_HOST`
- `LINGMA_PROXY_PORT`
- `LINGMA_PROXY_CWD`
- `LINGMA_PROXY_CURRENT_FILE_PATH`
- `LINGMA_PROXY_MODE`
- `LINGMA_PROXY_SHELL_TYPE`
- `LINGMA_PROXY_SESSION_MODE`
- `LINGMA_PROXY_TIMEOUT_SECONDS`
## Examples
Anthropic:
```powershell
$body = @{
model = "dashscope_qwen3_coder"
messages = @(
@{ role = "user"; content = "请只回复ANTHROPIC_OK" }
)
stream = $false
} | ConvertTo-Json -Depth 8
Invoke-RestMethod `
-Method Post `
-Uri http://127.0.0.1:8095/v1/messages `
-ContentType "application/json" `
-Body $body
```
OpenAI:
```powershell
$body = @{
model = "dashscope_qwen3_coder"
messages = @(
@{ role = "user"; content = "请只回复OPENAI_OK" }
)
stream = $false
} | ConvertTo-Json -Depth 8
Invoke-RestMethod `
-Method Post `
-Uri http://127.0.0.1:8095/v1/chat/completions `
-ContentType "application/json" `
-Body $body
```