chatccc 0.2.189 → 0.2.190
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
CHANGED
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@ describe("builtin ChatSession config", () => {
|
|
|
20
20
|
config.ccc = {
|
|
21
21
|
DEEPSEEK_API_KEY: "",
|
|
22
22
|
DEEPSEEK_BASE_URL: "https://api.deepseek.com/v1",
|
|
23
|
-
model: "deepseek-v4-pro
|
|
23
|
+
model: "deepseek-v4-pro",
|
|
24
24
|
};
|
|
25
25
|
process.env.DEEPSEEK_API_KEY = "sk-env-should-not-be-used";
|
|
26
26
|
|
|
@@ -47,7 +47,7 @@ describe("config.sample.json", () => {
|
|
|
47
47
|
|
|
48
48
|
expect(sample.ccc?.DEEPSEEK_API_KEY).toBe("");
|
|
49
49
|
expect(sample.ccc?.DEEPSEEK_BASE_URL).toBe("https://api.deepseek.com/v1");
|
|
50
|
-
expect(sample.ccc?.model).toBe("deepseek-v4-pro
|
|
50
|
+
expect(sample.ccc?.model).toBe("deepseek-v4-pro");
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
it("keeps Chrome CDP guard disabled by default with port 15166", () => {
|
|
@@ -84,6 +84,7 @@ import {
|
|
|
84
84
|
} from "../session.ts";
|
|
85
85
|
import { activePrompts, resetBindingState } from "../session-chat-binding.ts";
|
|
86
86
|
import { ABD_APPEND_PROMPT } from "../shared-prefix.ts";
|
|
87
|
+
import { config } from "../config.ts";
|
|
87
88
|
|
|
88
89
|
function mockPlatform(kind: "wechat" | "feishu" = "wechat"): PlatformAdapter {
|
|
89
90
|
return {
|
|
@@ -132,6 +133,9 @@ describe("handleCommand WeChat processing ack", () => {
|
|
|
132
133
|
_setSessionToolsFileForTest(join(tempDir, "sessions.json"));
|
|
133
134
|
resetState();
|
|
134
135
|
resetBindingState();
|
|
136
|
+
config.claude.defaultAgent = true;
|
|
137
|
+
config.cursor.defaultAgent = false;
|
|
138
|
+
config.codex.defaultAgent = false;
|
|
135
139
|
mockStreamStates.clear();
|
|
136
140
|
mockGetCodexUsageSummary.mockReset();
|
|
137
141
|
mockGetCursorUsageSummary.mockReset();
|
package/src/builtin/index.ts
CHANGED
|
@@ -66,6 +66,7 @@ interface ChatMessage {
|
|
|
66
66
|
|
|
67
67
|
export class ChatSession {
|
|
68
68
|
private model: any;
|
|
69
|
+
private systemPrompt: string;
|
|
69
70
|
private messages: ChatMessage[];
|
|
70
71
|
|
|
71
72
|
constructor(
|
|
@@ -98,7 +99,8 @@ export class ChatSession {
|
|
|
98
99
|
systemContent.push("", `当前工作目录: ${options.cwd}`);
|
|
99
100
|
}
|
|
100
101
|
|
|
101
|
-
this.
|
|
102
|
+
this.systemPrompt = systemContent.join("\n");
|
|
103
|
+
this.messages = [];
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
/**
|
|
@@ -124,6 +126,7 @@ export class ChatSession {
|
|
|
124
126
|
try {
|
|
125
127
|
const result = streamText({
|
|
126
128
|
model: this.model,
|
|
129
|
+
system: this.systemPrompt,
|
|
127
130
|
messages: this.messages as any,
|
|
128
131
|
abortSignal: signal,
|
|
129
132
|
});
|
|
@@ -152,17 +155,16 @@ export class ChatSession {
|
|
|
152
155
|
|
|
153
156
|
/** 返回当前的会话历史(只读) */
|
|
154
157
|
get history(): ReadonlyArray<ChatMessage> {
|
|
155
|
-
return this.messages;
|
|
158
|
+
return [{ role: "system", content: this.systemPrompt }, ...this.messages];
|
|
156
159
|
}
|
|
157
160
|
|
|
158
161
|
/** 返回当前轮数(不含 system 消息) */
|
|
159
162
|
get turnCount(): number {
|
|
160
|
-
return this.messages.length
|
|
163
|
+
return this.messages.length;
|
|
161
164
|
}
|
|
162
165
|
|
|
163
166
|
/** 清空会话历史,保留 system 消息 */
|
|
164
167
|
reset(): void {
|
|
165
|
-
|
|
166
|
-
this.messages = [system];
|
|
168
|
+
this.messages = [];
|
|
167
169
|
}
|
|
168
170
|
}
|
package/src/config.ts
CHANGED
|
@@ -207,7 +207,7 @@ export function getDefaultEffortForTool(tool: AgentTool, cfg: AppConfig = config
|
|
|
207
207
|
const CONFIG_FILE = join(USER_DATA_DIR, "config.json");
|
|
208
208
|
const CONFIG_SAMPLE_FILE = join(PROJECT_ROOT, "config.sample.json");
|
|
209
209
|
export const DEFAULT_CCC_DEEPSEEK_BASE_URL = "https://api.deepseek.com/v1";
|
|
210
|
-
export const DEFAULT_CCC_MODEL = "deepseek-v4-pro
|
|
210
|
+
export const DEFAULT_CCC_MODEL = "deepseek-v4-pro";
|
|
211
211
|
|
|
212
212
|
/**
|
|
213
213
|
* 将旧位置(PROJECT_ROOT)的持久化数据一次性迁移到 USER_DATA_DIR。
|