claw-subagent-service 0.0.150 → 0.0.152
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -81,6 +81,8 @@ async function getOrCreateGatewaySession(fallbackSessionId) {
|
|
|
81
81
|
if (response.status === 200) {
|
|
82
82
|
console.log(`[CHAT-DEBUG] Fallback session exists: ${fallbackSessionId}`);
|
|
83
83
|
return fallbackSessionId;
|
|
84
|
+
} else {
|
|
85
|
+
console.log(`[CHAT-DEBUG] Fallback session not found (status: ${response.status}): ${fallbackSessionId}`);
|
|
84
86
|
}
|
|
85
87
|
} catch (e) {
|
|
86
88
|
console.log(`[CHAT-DEBUG] Fallback session check failed: ${e.message}`);
|
|
@@ -89,6 +91,7 @@ async function getOrCreateGatewaySession(fallbackSessionId) {
|
|
|
89
91
|
|
|
90
92
|
// 如果 fallback 无效,创建新 session
|
|
91
93
|
try {
|
|
94
|
+
console.log(`[CHAT-DEBUG] Creating new session...`);
|
|
92
95
|
const response = await axios.post(
|
|
93
96
|
`${GATEWAY_URL}/session`,
|
|
94
97
|
{ title: 'Chat session' },
|
|
@@ -101,14 +104,13 @@ async function getOrCreateGatewaySession(fallbackSessionId) {
|
|
|
101
104
|
}
|
|
102
105
|
} catch (e) {
|
|
103
106
|
console.log(`[CHAT-DEBUG] Failed to create session: ${e.message}`);
|
|
107
|
+
if (e.response) {
|
|
108
|
+
console.log(`[CHAT-DEBUG] Create session response status: ${e.response.status}`);
|
|
109
|
+
console.log(`[CHAT-DEBUG] Create session response data: ${JSON.stringify(e.response.data)}`);
|
|
110
|
+
}
|
|
104
111
|
}
|
|
105
112
|
|
|
106
|
-
//
|
|
107
|
-
if (fallbackSessionId) {
|
|
108
|
-
console.log(`[CHAT-DEBUG] Using fallback session (without validation): ${fallbackSessionId}`);
|
|
109
|
-
return fallbackSessionId;
|
|
110
|
-
}
|
|
111
|
-
|
|
113
|
+
// 如果创建也失败,抛出错误
|
|
112
114
|
throw new Error('无法获取或创建有效的 session ID');
|
|
113
115
|
}
|
|
114
116
|
|
|
@@ -165,10 +167,10 @@ async function forwardChatMessage(sessionId, content, onDelta, logFn, timeoutMs
|
|
|
165
167
|
log('DEBUG', `请求超时: ${timeoutMs}ms`);
|
|
166
168
|
|
|
167
169
|
// 构建请求体,包含 system 和 model 参数
|
|
168
|
-
// model 字段格式: "provider
|
|
170
|
+
// model 字段格式: { providerID: "provider-name", modelID: "model-id" }
|
|
171
|
+
// 如果 OpenCode 配置为空,尝试不使用 model 字段
|
|
169
172
|
const requestBody = {
|
|
170
173
|
system: SYSTEM_PROMPT,
|
|
171
|
-
model: 'kimi-coding/kimi-k2.6',
|
|
172
174
|
parts: [{ type: 'text', text: content }]
|
|
173
175
|
};
|
|
174
176
|
|