Default to remote Kimi mode
This commit is contained in:
@@ -28,8 +28,10 @@ type RequestRecord struct {
|
||||
Time string `json:"time"`
|
||||
Method string `json:"method"`
|
||||
Path string `json:"path"`
|
||||
Model string `json:"model,omitempty"`
|
||||
StatusCode int `json:"statusCode"`
|
||||
Duration string `json:"duration"`
|
||||
Size string `json:"size,omitempty"`
|
||||
ReqBody string `json:"reqBody,omitempty"`
|
||||
RespBody string `json:"respBody,omitempty"`
|
||||
}
|
||||
@@ -385,8 +387,10 @@ func (a *App) StartProxy() error {
|
||||
Time: time.Now().Format("15:04:05"),
|
||||
Method: method,
|
||||
Path: path,
|
||||
Model: extractRequestModel(reqBody),
|
||||
StatusCode: statusCode,
|
||||
Duration: duration.Round(time.Millisecond).String(),
|
||||
Size: formatPayloadSize(len(reqBody) + len(respBody)),
|
||||
ReqBody: reqBody,
|
||||
RespBody: respBody,
|
||||
})
|
||||
@@ -581,15 +585,44 @@ func (a *App) fetchModels(addr string) ([]ModelInfo, error) {
|
||||
return models, nil
|
||||
}
|
||||
|
||||
func extractRequestModel(reqBody string) string {
|
||||
if strings.TrimSpace(reqBody) == "" {
|
||||
return ""
|
||||
}
|
||||
var payload map[string]any
|
||||
if err := json.Unmarshal([]byte(reqBody), &payload); err != nil {
|
||||
return ""
|
||||
}
|
||||
if model, ok := payload["model"].(string); ok {
|
||||
return strings.TrimSpace(model)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func formatPayloadSize(bytes int) string {
|
||||
if bytes <= 0 {
|
||||
return "-"
|
||||
}
|
||||
const kb = 1024
|
||||
const mb = 1024 * kb
|
||||
if bytes >= mb {
|
||||
return fmt.Sprintf("%.1f MB", float64(bytes)/float64(mb))
|
||||
}
|
||||
if bytes >= kb {
|
||||
return fmt.Sprintf("%.1f KB", float64(bytes)/float64(kb))
|
||||
}
|
||||
return fmt.Sprintf("%d B", bytes)
|
||||
}
|
||||
|
||||
func defaultConfig() service.Config {
|
||||
cfg := service.Config{
|
||||
Host: "127.0.0.1",
|
||||
Port: 8095,
|
||||
Backend: service.BackendIPC,
|
||||
Backend: service.BackendRemote,
|
||||
Transport: lingmaipc.TransportAuto,
|
||||
Cwd: defaultCwd(),
|
||||
Mode: "agent",
|
||||
Model: "MiniMax-M2.7",
|
||||
Model: "kmodel",
|
||||
ShellType: defaultShellType(),
|
||||
SessionMode: service.SessionModeAuto,
|
||||
Timeout: 120 * time.Second,
|
||||
|
||||
@@ -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.4.1</small>
|
||||
<small>v1.4.2</small>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
@@ -35,6 +35,12 @@ let clockInterval = null
|
||||
|
||||
const endpoint = computed(() => (status.value.addr ? `http://${status.value.addr}` : '未启动'))
|
||||
const isRunning = computed(() => Boolean(status.value.running))
|
||||
const isRemoteBackend = computed(() => status.value.backend === 'remote' || config.value.Backend === 'remote' || health.value?.state?.transport === 'remote')
|
||||
const transportLabel = computed(() => {
|
||||
if (isRemoteBackend.value) return 'Remote API'
|
||||
return health.value?.state?.transport || config.value.Transport || 'auto'
|
||||
})
|
||||
const sessionLabel = computed(() => health.value?.state?.session_mode || config.value.SessionMode || 'auto')
|
||||
const runningDuration = computed(() => {
|
||||
if (!isRunning.value || !status.value.startedAt) return '未运行'
|
||||
const startedAt = new Date(status.value.startedAt).getTime()
|
||||
@@ -228,11 +234,11 @@ onUnmounted(() => {
|
||||
</div>
|
||||
<div class="strip-cell">
|
||||
<label>Transport</label>
|
||||
<strong>{{ health?.state?.transport || 'WebSocket' }}</strong>
|
||||
<strong>{{ transportLabel }}</strong>
|
||||
</div>
|
||||
<div class="strip-cell">
|
||||
<label>Session</label>
|
||||
<strong>{{ health?.state?.session_mode || 'Reuse' }}</strong>
|
||||
<strong>{{ sessionLabel }}</strong>
|
||||
</div>
|
||||
<div class="strip-actions">
|
||||
<button :class="{ active: !isRunning }" type="button" :disabled="loading || isRunning" @click="toggleProxy">启动</button>
|
||||
@@ -322,7 +328,7 @@ onUnmounted(() => {
|
||||
<div class="setting-row">
|
||||
<div>
|
||||
<div class="cell-main">Transport</div>
|
||||
<div class="cell-sub">{{ config.Transport || 'WebSocket' }}</div>
|
||||
<div class="cell-sub">{{ transportLabel }}</div>
|
||||
</div>
|
||||
<span class="status-chip ok"><i class="bi bi-check"></i></span>
|
||||
</div>
|
||||
@@ -383,10 +389,10 @@ onUnmounted(() => {
|
||||
<td>{{ request.time }}</td>
|
||||
<td>{{ request.method }}</td>
|
||||
<td>{{ request.path }}</td>
|
||||
<td>{{ request.model || status.model || 'MiniMax-M2.7' }}</td>
|
||||
<td>{{ request.model || '-' }}</td>
|
||||
<td><span class="status-chip" :class="statusClass(request.statusCode)">{{ request.statusCode }}</span></td>
|
||||
<td>{{ request.duration }}</td>
|
||||
<td>{{ request.size || '2.1 KB' }}</td>
|
||||
<td>{{ request.size || '-' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -88,7 +88,7 @@ onMounted(refresh)
|
||||
<div class="panel-header">
|
||||
<div>
|
||||
<h2>可用模型</h2>
|
||||
<p>推荐 OpenClaw / Hermes / Claude Code / Cline 优先选择 MiniMax-M2.7。</p>
|
||||
<p>远端 API 模式推荐 Kimi-K2.6;MiniMax-M2.7 可作为速度优先备选。</p>
|
||||
</div>
|
||||
<input v-model="query" class="search-input" type="search" placeholder="搜索模型" style="max-width: 260px" />
|
||||
</div>
|
||||
|
||||
@@ -82,8 +82,10 @@ export namespace main {
|
||||
time: string;
|
||||
method: string;
|
||||
path: string;
|
||||
model?: string;
|
||||
statusCode: number;
|
||||
duration: string;
|
||||
size?: string;
|
||||
reqBody?: string;
|
||||
respBody?: string;
|
||||
|
||||
@@ -96,8 +98,10 @@ export namespace main {
|
||||
this.time = source["time"];
|
||||
this.method = source["method"];
|
||||
this.path = source["path"];
|
||||
this.model = source["model"];
|
||||
this.statusCode = source["statusCode"];
|
||||
this.duration = source["duration"];
|
||||
this.size = source["size"];
|
||||
this.reqBody = source["reqBody"];
|
||||
this.respBody = source["respBody"];
|
||||
}
|
||||
|
||||
@@ -11,6 +11,6 @@
|
||||
"email": "lutc5@asiainfo.com"
|
||||
},
|
||||
"info": {
|
||||
"productVersion": "1.4.0"
|
||||
"productVersion": "1.4.2"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user