chatccc 0.2.61 → 0.2.62
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/config.sample.json +2 -1
- package/im-skills/feishu-skill/download-video.mjs +17 -10
- package/package.json +59 -59
- package/src/config.ts +24 -2
- package/src/index.ts +5 -2
- package/src/orchestrator.ts +2 -1
- package/src/web-ui.ts +26 -3
package/config.sample.json
CHANGED
|
@@ -30,6 +30,12 @@ function walkUpForConfig(startDir) {
|
|
|
30
30
|
return result;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
function getBaseUrl(domain) {
|
|
34
|
+
return domain === "lark"
|
|
35
|
+
? "https://open.larksuite.com/open-apis"
|
|
36
|
+
: "https://open.feishu.cn/open-apis";
|
|
37
|
+
}
|
|
38
|
+
|
|
33
39
|
async function findConfig() {
|
|
34
40
|
const paths = [
|
|
35
41
|
join(homedir(), ".chatccc", "config.json"),
|
|
@@ -44,7 +50,7 @@ async function findConfig() {
|
|
|
44
50
|
const appSecret = cfg.feishu?.appSecret || "";
|
|
45
51
|
if (appId && appSecret) {
|
|
46
52
|
console.error(`Using config: ${path}`);
|
|
47
|
-
return { appId, appSecret };
|
|
53
|
+
return { appId, appSecret, baseUrl: getBaseUrl(cfg.feishu?.domain) };
|
|
48
54
|
}
|
|
49
55
|
} catch {
|
|
50
56
|
// Try the next candidate.
|
|
@@ -53,8 +59,8 @@ async function findConfig() {
|
|
|
53
59
|
throw new Error(`Could not find Feishu config. Tried: ${paths.slice(0, 3).join(", ")}...`);
|
|
54
60
|
}
|
|
55
61
|
|
|
56
|
-
async function getTenantAccessToken(appId, appSecret) {
|
|
57
|
-
const response = await fetch(
|
|
62
|
+
async function getTenantAccessToken(appId, appSecret, baseUrl) {
|
|
63
|
+
const response = await fetch(`${baseUrl}/auth/v3/tenant_access_token/internal`, {
|
|
58
64
|
method: "POST",
|
|
59
65
|
headers: { "Content-Type": "application/json; charset=utf-8" },
|
|
60
66
|
body: Buffer.from(JSON.stringify({ app_id: appId, app_secret: appSecret }), "utf8"),
|
|
@@ -66,10 +72,10 @@ async function getTenantAccessToken(appId, appSecret) {
|
|
|
66
72
|
return data.tenant_access_token;
|
|
67
73
|
}
|
|
68
74
|
|
|
69
|
-
async function findMessageId(token, chatId, fileKey) {
|
|
75
|
+
async function findMessageId(token, baseUrl, chatId, fileKey) {
|
|
70
76
|
let pageToken = "";
|
|
71
77
|
for (let page = 0; page < 10; page++) {
|
|
72
|
-
const url = new URL(
|
|
78
|
+
const url = new URL(`${baseUrl}/im/v1/messages`);
|
|
73
79
|
url.searchParams.set("receive_id_type", "chat_id");
|
|
74
80
|
url.searchParams.set("receive_id", chatId);
|
|
75
81
|
url.searchParams.set("page_size", "50");
|
|
@@ -101,8 +107,8 @@ function safeFileName(name) {
|
|
|
101
107
|
return (name || "download.bin").replace(/[\\/:*?"<>|]/g, "_");
|
|
102
108
|
}
|
|
103
109
|
|
|
104
|
-
async function downloadResource(token, messageId, fileKey, fileName) {
|
|
105
|
-
const url =
|
|
110
|
+
async function downloadResource(token, baseUrl, messageId, fileKey, fileName) {
|
|
111
|
+
const url = `${baseUrl}/im/v1/messages/${encodeURIComponent(messageId)}/resources/${encodeURIComponent(fileKey)}?type=file`;
|
|
106
112
|
console.error(`Downloading: ${url}`);
|
|
107
113
|
|
|
108
114
|
const response = await fetch(url, { headers: { Authorization: `Bearer ${token}` } });
|
|
@@ -131,12 +137,12 @@ async function main() {
|
|
|
131
137
|
process.exit(1);
|
|
132
138
|
}
|
|
133
139
|
|
|
134
|
-
const { appId, appSecret } = await findConfig();
|
|
135
|
-
const token = await getTenantAccessToken(appId, appSecret);
|
|
140
|
+
const { appId, appSecret, baseUrl } = await findConfig();
|
|
141
|
+
const token = await getTenantAccessToken(appId, appSecret, baseUrl);
|
|
136
142
|
|
|
137
143
|
let messageId = args["message-id"] || "";
|
|
138
144
|
if (!messageId && args["chat-id"]) {
|
|
139
|
-
messageId = await findMessageId(token, args["chat-id"], args["file-key"]);
|
|
145
|
+
messageId = await findMessageId(token, baseUrl, args["chat-id"], args["file-key"]);
|
|
140
146
|
if (!messageId) {
|
|
141
147
|
throw new Error(`No message found for file_key=${args["file-key"]}`);
|
|
142
148
|
}
|
|
@@ -149,6 +155,7 @@ async function main() {
|
|
|
149
155
|
|
|
150
156
|
const localPath = await downloadResource(
|
|
151
157
|
token,
|
|
158
|
+
baseUrl,
|
|
152
159
|
messageId,
|
|
153
160
|
args["file-key"],
|
|
154
161
|
args.name || "download.bin",
|
package/package.json
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "chatccc",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Feishu bot bridge for Claude Code",
|
|
5
|
-
"license": "Apache-2.0",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"main": "./src/index.ts",
|
|
8
|
-
"bin": {
|
|
9
|
-
"chatccc": "bin/chatccc.mjs"
|
|
10
|
-
},
|
|
11
|
-
"files": [
|
|
12
|
-
"src/",
|
|
13
|
-
"bin/",
|
|
14
|
-
"demo/ilink_echo_probe.ts",
|
|
15
|
-
"im-skills/",
|
|
16
|
-
"images/img_readme_*.jpg",
|
|
17
|
-
"images/img_readme_*.png",
|
|
18
|
-
"images/avatars/status_*.png",
|
|
19
|
-
"images/avatars/badges/",
|
|
20
|
-
"package.json",
|
|
21
|
-
"README.md",
|
|
22
|
-
"config.sample.json"
|
|
23
|
-
],
|
|
24
|
-
"scripts": {
|
|
25
|
-
"dev": "tsx src/index.ts",
|
|
26
|
-
"chatccc": "tsx src/index.ts",
|
|
27
|
-
"start": "tsx src/index.ts",
|
|
28
|
-
"demo:bot-test": "tsx demo/bot_test.ts",
|
|
29
|
-
"demo:bot-test:local": "tsx demo/bot_test.ts --local",
|
|
30
|
-
"demo:create-group": "tsx src/index.ts",
|
|
31
|
-
"demo:create-group:local": "tsx src/index.ts --local",
|
|
32
|
-
"demo:permission-check": "tsx demo/permission_check.ts",
|
|
33
|
-
"demo:claude-hi": "tsx demo/claude_say_hi.ts",
|
|
34
|
-
"demo:codex-hi": "tsx demo/codex_say_hi.ts",
|
|
35
|
-
"demo:ilink-echo": "tsx demo/ilink_echo_probe.ts",
|
|
36
|
-
"test": "vitest run",
|
|
37
|
-
"test:watch": "vitest"
|
|
38
|
-
},
|
|
39
|
-
"dependencies": {
|
|
40
|
-
"@anthropic-ai/claude-agent-sdk": "0.2.133",
|
|
41
|
-
"@larksuiteoapi/node-sdk": "^1.59.0",
|
|
42
|
-
"@openilink/openilink-sdk-node": "^0.6.0",
|
|
43
|
-
"nodemailer": "^8.0.7",
|
|
44
|
-
"qrcode-terminal": "^0.12.0",
|
|
45
|
-
"sharp": "^0.34.5",
|
|
46
|
-
"tsx": "^4.0.0",
|
|
47
|
-
"ws": "^8.18.0"
|
|
48
|
-
},
|
|
49
|
-
"devDependencies": {
|
|
50
|
-
"@types/node": "^20.0.0",
|
|
51
|
-
"@types/qrcode-terminal": "^0.12.2",
|
|
52
|
-
"@types/ws": "^8.18.1",
|
|
53
|
-
"typescript": "^5.0.0",
|
|
54
|
-
"vitest": "^4.1.5"
|
|
55
|
-
},
|
|
56
|
-
"engines": {
|
|
57
|
-
"node": ">=20"
|
|
58
|
-
}
|
|
59
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "chatccc",
|
|
3
|
+
"version": "0.2.62",
|
|
4
|
+
"description": "Feishu bot bridge for Claude Code",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./src/index.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"chatccc": "bin/chatccc.mjs"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"src/",
|
|
13
|
+
"bin/",
|
|
14
|
+
"demo/ilink_echo_probe.ts",
|
|
15
|
+
"im-skills/",
|
|
16
|
+
"images/img_readme_*.jpg",
|
|
17
|
+
"images/img_readme_*.png",
|
|
18
|
+
"images/avatars/status_*.png",
|
|
19
|
+
"images/avatars/badges/",
|
|
20
|
+
"package.json",
|
|
21
|
+
"README.md",
|
|
22
|
+
"config.sample.json"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"dev": "tsx src/index.ts",
|
|
26
|
+
"chatccc": "tsx src/index.ts",
|
|
27
|
+
"start": "tsx src/index.ts",
|
|
28
|
+
"demo:bot-test": "tsx demo/bot_test.ts",
|
|
29
|
+
"demo:bot-test:local": "tsx demo/bot_test.ts --local",
|
|
30
|
+
"demo:create-group": "tsx src/index.ts",
|
|
31
|
+
"demo:create-group:local": "tsx src/index.ts --local",
|
|
32
|
+
"demo:permission-check": "tsx demo/permission_check.ts",
|
|
33
|
+
"demo:claude-hi": "tsx demo/claude_say_hi.ts",
|
|
34
|
+
"demo:codex-hi": "tsx demo/codex_say_hi.ts",
|
|
35
|
+
"demo:ilink-echo": "tsx demo/ilink_echo_probe.ts",
|
|
36
|
+
"test": "vitest run",
|
|
37
|
+
"test:watch": "vitest"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@anthropic-ai/claude-agent-sdk": "0.2.133",
|
|
41
|
+
"@larksuiteoapi/node-sdk": "^1.59.0",
|
|
42
|
+
"@openilink/openilink-sdk-node": "^0.6.0",
|
|
43
|
+
"nodemailer": "^8.0.7",
|
|
44
|
+
"qrcode-terminal": "^0.12.0",
|
|
45
|
+
"sharp": "^0.34.5",
|
|
46
|
+
"tsx": "^4.0.0",
|
|
47
|
+
"ws": "^8.18.0"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@types/node": "^20.0.0",
|
|
51
|
+
"@types/qrcode-terminal": "^0.12.2",
|
|
52
|
+
"@types/ws": "^8.18.1",
|
|
53
|
+
"typescript": "^5.0.0",
|
|
54
|
+
"vitest": "^4.1.5"
|
|
55
|
+
},
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=20"
|
|
58
|
+
}
|
|
59
|
+
}
|
package/src/config.ts
CHANGED
|
@@ -5,6 +5,8 @@ import { dirname, join } from "node:path";
|
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { appendFile, cp, mkdir, readFile, stat, writeFile } from "node:fs/promises";
|
|
7
7
|
|
|
8
|
+
import { Domain } from "@larksuiteoapi/node-sdk";
|
|
9
|
+
|
|
8
10
|
import { printServiceDidNotStart } from "./exit-banner.ts";
|
|
9
11
|
import { appendStartupTrace, setupFileLogging } from "./shared.ts";
|
|
10
12
|
import {
|
|
@@ -90,9 +92,25 @@ export interface CodexConfig {
|
|
|
90
92
|
effort: string;
|
|
91
93
|
}
|
|
92
94
|
|
|
95
|
+
export type FeishuDomain = "feishu" | "lark";
|
|
96
|
+
|
|
93
97
|
export interface FeishuConfig {
|
|
94
98
|
appId: string;
|
|
95
99
|
appSecret: string;
|
|
100
|
+
/** "feishu" (默认) → https://open.feishu.cn, "lark" → https://open.larksuite.com */
|
|
101
|
+
domain?: FeishuDomain;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** 用户配置的 domain 字符串 → SDK Domain 枚举 */
|
|
105
|
+
export function feishuDomainToSdkDomain(domain?: FeishuDomain): Domain {
|
|
106
|
+
return domain === "lark" ? Domain.Lark : Domain.Feishu;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** 用户配置的 domain 字符串 → REST API base URL */
|
|
110
|
+
export function feishuDomainToBaseUrl(domain?: FeishuDomain): string {
|
|
111
|
+
return domain === "lark"
|
|
112
|
+
? "https://open.larksuite.com/open-apis"
|
|
113
|
+
: "https://open.feishu.cn/open-apis";
|
|
96
114
|
}
|
|
97
115
|
|
|
98
116
|
export interface PlatformConfig {
|
|
@@ -298,7 +316,7 @@ function autofillToolPathsAfterSampleCopy(configFile: string): void {
|
|
|
298
316
|
|
|
299
317
|
function loadConfig(): AppConfig {
|
|
300
318
|
const defaults: AppConfig = {
|
|
301
|
-
feishu: { appId: "", appSecret: "" },
|
|
319
|
+
feishu: { appId: "", appSecret: "", domain: "feishu" },
|
|
302
320
|
platforms: { feishu: { enabled: true }, ilink: { enabled: true } },
|
|
303
321
|
port: 18080,
|
|
304
322
|
gitTimeoutSeconds: 180,
|
|
@@ -358,6 +376,8 @@ function loadConfig(): AppConfig {
|
|
|
358
376
|
}
|
|
359
377
|
|
|
360
378
|
const feishu = parsed.feishu ?? { appId: "", appSecret: "" };
|
|
379
|
+
const feishuDomain: FeishuDomain =
|
|
380
|
+
(feishu as { domain?: unknown }).domain === "lark" ? "lark" : "feishu";
|
|
361
381
|
const claude = parsed.claude ?? {} as Partial<ClaudeConfig>;
|
|
362
382
|
const cursorRaw = (parsed.cursor ?? {}) as NonNullable<typeof parsed.cursor>;
|
|
363
383
|
const codexRaw = (parsed.codex ?? {}) as NonNullable<typeof parsed.codex>;
|
|
@@ -420,6 +440,7 @@ function loadConfig(): AppConfig {
|
|
|
420
440
|
feishu: {
|
|
421
441
|
appId: feishu.appId ?? "",
|
|
422
442
|
appSecret: feishu.appSecret ?? "",
|
|
443
|
+
domain: feishuDomain,
|
|
423
444
|
},
|
|
424
445
|
platforms: {
|
|
425
446
|
feishu: {
|
|
@@ -497,7 +518,7 @@ export let APP_SECRET = config.feishu.appSecret;
|
|
|
497
518
|
export let FEISHU_ENABLED = config.platforms.feishu.enabled;
|
|
498
519
|
export let ILINK_ENABLED = config.platforms.ilink.enabled;
|
|
499
520
|
export let ILINK_REUSE_TOKEN_ON_START = config.platforms.ilink.reuseTokenOnStart ?? true;
|
|
500
|
-
export
|
|
521
|
+
export let BASE_URL = feishuDomainToBaseUrl(config.feishu.domain);
|
|
501
522
|
export const CHATCCC_PORT = config.port;
|
|
502
523
|
|
|
503
524
|
/** 与 CHATCCC_PORT 一致,供 --local 连接本机中继 */
|
|
@@ -576,6 +597,7 @@ export function applyLoadedConfig(next: AppConfig): void {
|
|
|
576
597
|
|
|
577
598
|
APP_ID = next.feishu.appId;
|
|
578
599
|
APP_SECRET = next.feishu.appSecret;
|
|
600
|
+
BASE_URL = feishuDomainToBaseUrl(next.feishu.domain);
|
|
579
601
|
FEISHU_ENABLED = next.platforms.feishu.enabled;
|
|
580
602
|
ILINK_ENABLED = next.platforms.ilink.enabled;
|
|
581
603
|
ILINK_REUSE_TOKEN_ON_START = next.platforms.ilink.reuseTokenOnStart ?? true;
|
package/src/index.ts
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
import { createServer, type IncomingMessage, type Server, type ServerResponse } from "node:http";
|
|
26
26
|
|
|
27
|
-
import { WSClient, EventDispatcher } from "@larksuiteoapi/node-sdk";
|
|
27
|
+
import { WSClient, EventDispatcher, Domain } from "@larksuiteoapi/node-sdk";
|
|
28
28
|
import WebSocket from "ws";
|
|
29
29
|
|
|
30
30
|
import { appendStartupTrace, attachRelayWebSocket, ensureSingleInstance, freeRelayListenPort, installCrashLogging, waitForPortFree } from "./shared.ts";
|
|
@@ -50,6 +50,8 @@ import {
|
|
|
50
50
|
maskAppId,
|
|
51
51
|
resolveDefaultAgentTool,
|
|
52
52
|
toolDisplayName,
|
|
53
|
+
config,
|
|
54
|
+
feishuDomainToSdkDomain,
|
|
53
55
|
ts,
|
|
54
56
|
} from "./config.ts";
|
|
55
57
|
import { printServiceDidNotStart, printServiceRunningHint } from "./exit-banner.ts";
|
|
@@ -403,7 +405,7 @@ async function startBotServiceCore(): Promise<void> {
|
|
|
403
405
|
console.error(` 接口: POST ${BASE_URL}/auth/v3/tenant_access_token/internal`);
|
|
404
406
|
console.error(" 常见原因:");
|
|
405
407
|
console.error(
|
|
406
|
-
|
|
408
|
+
` - 本机网络无法访问 ${new URL(BASE_URL).hostname}(可尝试:关闭系统/终端代理、检查防火墙;Windows 可管理员运行 netsh winsock reset 后重启)`,
|
|
407
409
|
);
|
|
408
410
|
console.error(" - App ID / App Secret 与开放平台「凭证与基础信息」不一致");
|
|
409
411
|
console.error(" - 自建应用尚未创建/发布可用版本");
|
|
@@ -594,6 +596,7 @@ async function startBotServiceCore(): Promise<void> {
|
|
|
594
596
|
const wsClient = new WSClient({
|
|
595
597
|
appId: APP_ID,
|
|
596
598
|
appSecret: APP_SECRET,
|
|
599
|
+
domain: feishuDomainToSdkDomain(config.feishu.domain),
|
|
597
600
|
onReady: async () => {
|
|
598
601
|
await rebuildBindingsFromRegistry().catch((err) =>
|
|
599
602
|
console.error(`[${ts()}] [SDK READY] rebuild bindings failed: ${(err as Error).message}`)
|
package/src/orchestrator.ts
CHANGED
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
setDefaultCwd,
|
|
22
22
|
getRecentDirs,
|
|
23
23
|
addRecentDir,
|
|
24
|
+
resolveDefaultAgentTool,
|
|
24
25
|
sessionPrefixForTool,
|
|
25
26
|
toolDisplayName,
|
|
26
27
|
ts,
|
|
@@ -240,7 +241,7 @@ export async function handleCommand(
|
|
|
240
241
|
|
|
241
242
|
if (textLower === "/new" || textLower.startsWith("/new ")) {
|
|
242
243
|
const toolArg = text.slice(5).trim().toLowerCase();
|
|
243
|
-
const tool = toolArg ||
|
|
244
|
+
const tool = toolArg || resolveDefaultAgentTool();
|
|
244
245
|
logTrace(tid, "BRANCH", { cmd: "/new", tool });
|
|
245
246
|
const validTools = ["claude", "cursor", "codex"];
|
|
246
247
|
if (!validTools.includes(tool)) {
|
package/src/web-ui.ts
CHANGED
|
@@ -342,6 +342,9 @@ export function unflattenConfig(flat: Record<string, unknown>): Record<string, u
|
|
|
342
342
|
} else if (key === "CHATCCC_APP_SECRET") {
|
|
343
343
|
result.feishu = result.feishu || {};
|
|
344
344
|
(result.feishu as Record<string, unknown>).appSecret = val;
|
|
345
|
+
} else if (key === "CHATCCC_FEISHU_DOMAIN") {
|
|
346
|
+
result.feishu = result.feishu || {};
|
|
347
|
+
(result.feishu as Record<string, unknown>).domain = val;
|
|
345
348
|
} else if (key === "CHATCCC_FEISHU_ENABLED") {
|
|
346
349
|
result.platforms = result.platforms || {};
|
|
347
350
|
(result.platforms as Record<string, unknown>).feishu = (result.platforms as Record<string, unknown>).feishu || {};
|
|
@@ -639,6 +642,14 @@ header .badge{font-size:13px;padding:4px 12px;border-radius:12px;font-weight:500
|
|
|
639
642
|
<input type="password" id="field-CHATCCC_APP_SECRET" placeholder="...">
|
|
640
643
|
<div class="hint">飞书开放平台「凭证与基础信息」→ App Secret</div>
|
|
641
644
|
</div>
|
|
645
|
+
<div class="form-group">
|
|
646
|
+
<label>平台域名</label>
|
|
647
|
+
<select id="field-CHATCCC_FEISHU_DOMAIN">
|
|
648
|
+
<option value="feishu">飞书 (open.feishu.cn)</option>
|
|
649
|
+
<option value="lark">Lark (open.larksuite.com)</option>
|
|
650
|
+
</select>
|
|
651
|
+
<div class="hint">国际版 Lark 用户请选择 Lark</div>
|
|
652
|
+
</div>
|
|
642
653
|
</div>
|
|
643
654
|
</div>
|
|
644
655
|
|
|
@@ -826,6 +837,7 @@ header .badge{font-size:13px;padding:4px 12px;border-radius:12px;font-weight:500
|
|
|
826
837
|
</div>
|
|
827
838
|
<div class="config-row"><span class="key">App ID</span><span class="val" id="cfg-APP_ID">-</span></div>
|
|
828
839
|
<div class="config-row"><span class="key">App Secret</span><span class="val" id="cfg-APP_SECRET">-</span></div>
|
|
840
|
+
<div class="config-row"><span class="key">平台域名</span><span class="val" id="cfg-FEISHU_DOMAIN">-</span></div>
|
|
829
841
|
<button class="btn btn-outline" style="margin-top:8px" onclick="editSection('feishu')">编辑</button>
|
|
830
842
|
</div>
|
|
831
843
|
</details>
|
|
@@ -926,7 +938,7 @@ const AGENT_FIELDS = {
|
|
|
926
938
|
cursor: ['CHATCCC_CURSOR_PATH','CHATCCC_CURSOR_MODEL'],
|
|
927
939
|
codex: ['CHATCCC_CODEX_PATH','CHATCCC_CODEX_MODEL','CHATCCC_CODEX_EFFORT']
|
|
928
940
|
};
|
|
929
|
-
const FEISHU_FIELDS = ['CHATCCC_APP_ID','CHATCCC_APP_SECRET'];
|
|
941
|
+
const FEISHU_FIELDS = ['CHATCCC_APP_ID','CHATCCC_APP_SECRET','CHATCCC_FEISHU_DOMAIN'];
|
|
930
942
|
|
|
931
943
|
// 当前选中的 Claude API 模式("official" / "thirdparty")
|
|
932
944
|
// Wizard / Dashboard 都通过这个变量驱动 UI 显隐和提交时的 mode 字段
|
|
@@ -1197,6 +1209,7 @@ function renderStep1() {
|
|
|
1197
1209
|
var f = c.feishu || {};
|
|
1198
1210
|
prefillNested('field-CHATCCC_APP_ID', f.appId);
|
|
1199
1211
|
prefillNested('field-CHATCCC_APP_SECRET', f.appSecret);
|
|
1212
|
+
prefillNested('field-CHATCCC_FEISHU_DOMAIN', f.domain || 'feishu');
|
|
1200
1213
|
// 平台开关:按已有 config 回填;首次配置(无飞书凭证)时默认关闭飞书、开启微信
|
|
1201
1214
|
var hasExistingCreds = Boolean(c.feishu?.appId?.trim() && c.feishu?.appSecret?.trim());
|
|
1202
1215
|
var feishuEnabled = hasExistingCreds
|
|
@@ -1349,6 +1362,7 @@ function renderStep3() {
|
|
|
1349
1362
|
if (state.platformsEnabled.feishu) {
|
|
1350
1363
|
lines.push('<div class="config-row"><span class="key">CHATCCC_APP_ID</span><span class="val">' + (vars.CHATCCC_APP_ID || '<span style="color:#ef4444">未填写</span>') + '</span></div>');
|
|
1351
1364
|
lines.push('<div class="config-row"><span class="key">CHATCCC_APP_SECRET</span><span class="val">' + (vars.CHATCCC_APP_SECRET ? '***已设置***' : '<span style="color:#ef4444">未填写</span>') + '</span></div>');
|
|
1365
|
+
lines.push('<div class="config-row"><span class="key">平台域名</span><span class="val">' + ((vars.CHATCCC_FEISHU_DOMAIN === 'lark') ? 'Lark (open.larksuite.com)' : '飞书 (open.feishu.cn)') + '</span></div>');
|
|
1352
1366
|
}
|
|
1353
1367
|
|
|
1354
1368
|
lines.push('<h3 style="margin:16px 0 8px">微信 iLink</h3>');
|
|
@@ -1534,6 +1548,7 @@ function updateDashboardUI() {
|
|
|
1534
1548
|
state.platformsEnabled.feishu = feishuEnabled;
|
|
1535
1549
|
document.getElementById('cfg-APP_ID').textContent = c.feishu && c.feishu.appId ? c.feishu.appId.slice(0,8) + '...' + c.feishu.appId.slice(-4) : '-';
|
|
1536
1550
|
document.getElementById('cfg-APP_SECRET').textContent = c.feishu && c.feishu.appSecret ? '***已设置***' : '-';
|
|
1551
|
+
document.getElementById('cfg-FEISHU_DOMAIN').textContent = (c.feishu && c.feishu.domain === 'lark') ? 'Lark (open.larksuite.com)' : '飞书 (open.feishu.cn)';
|
|
1537
1552
|
|
|
1538
1553
|
// 只显示已启用的 Agent 卡片(按 enabled 字段;缺省时退回到"任一字段非空"兼容旧 config)
|
|
1539
1554
|
var claudeOn = isAgentEnabled(c.claude, CLAUDE_FALLBACK_KEYS);
|
|
@@ -1636,7 +1651,7 @@ function editSection(section) {
|
|
|
1636
1651
|
|
|
1637
1652
|
var html = '';
|
|
1638
1653
|
var labelMap = {
|
|
1639
|
-
'CHATCCC_APP_ID': 'App ID', 'CHATCCC_APP_SECRET': 'App Secret',
|
|
1654
|
+
'CHATCCC_APP_ID': 'App ID', 'CHATCCC_APP_SECRET': 'App Secret', 'CHATCCC_FEISHU_DOMAIN': '平台域名',
|
|
1640
1655
|
'CLAUDE_API_KEY': 'API Key', 'CLAUDE_BASE_URL': 'Base URL',
|
|
1641
1656
|
'CHATCCC_ANTHROPIC_MODEL': '模型', 'CHATCCC_ANTHROPIC_SUBAGENT_MODEL': 'Subagent 模型', 'CHATCCC_ANTHROPIC_EFFORT': 'Effort',
|
|
1642
1657
|
'CHATCCC_CURSOR_PATH': 'CLI 路径', 'CHATCCC_CURSOR_MODEL': '模型',
|
|
@@ -1673,6 +1688,7 @@ function editSection(section) {
|
|
|
1673
1688
|
if (section === 'feishu') {
|
|
1674
1689
|
if (key === 'CHATCCC_APP_ID' && state.config.feishu) val = state.config.feishu.appId || '';
|
|
1675
1690
|
else if (key === 'CHATCCC_APP_SECRET' && state.config.feishu) val = state.config.feishu.appSecret || '';
|
|
1691
|
+
else if (key === 'CHATCCC_FEISHU_DOMAIN' && state.config.feishu) val = state.config.feishu.domain || 'feishu';
|
|
1676
1692
|
} else if (section === 'claude' && state.config.claude) {
|
|
1677
1693
|
if (key === 'CLAUDE_API_KEY') val = state.config.claude.apiKey || '';
|
|
1678
1694
|
else if (key === 'CLAUDE_BASE_URL') val = state.config.claude.baseUrl || '';
|
|
@@ -1707,7 +1723,14 @@ function editSection(section) {
|
|
|
1707
1723
|
var groupClass = 'form-group' + (isClaudeSubagentField && claudeApiMode !== 'thirdparty' ? ' hidden' : '');
|
|
1708
1724
|
var subagentAttr = isClaudeSubagentField ? ' data-claude-subagent-field="1"' : '';
|
|
1709
1725
|
html += '<div class="' + groupClass + '"' + subagentAttr + '><label>' + (labelMap[key] || key) + '</label>';
|
|
1710
|
-
|
|
1726
|
+
if (key === 'CHATCCC_FEISHU_DOMAIN') {
|
|
1727
|
+
html += '<select id="edit-' + key + '">';
|
|
1728
|
+
html += '<option value="feishu"' + (val === 'lark' ? '' : ' selected') + '>飞书 (open.feishu.cn)</option>';
|
|
1729
|
+
html += '<option value="lark"' + (val === 'lark' ? ' selected' : '') + '>Lark (open.larksuite.com)</option>';
|
|
1730
|
+
html += '</select>';
|
|
1731
|
+
} else {
|
|
1732
|
+
html += '<input type="' + (isSecret ? 'password' : 'text') + '" id="edit-' + key + '" value="' + String(val).replace(/"/g,'"') + '">';
|
|
1733
|
+
}
|
|
1711
1734
|
html += '</div>';
|
|
1712
1735
|
});
|
|
1713
1736
|
|