snow-ai 0.6.37 → 0.6.38
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/bundle/cli.mjs +227 -106
- package/bundle/package.json +1 -1
- package/package.json +1 -1
package/bundle/cli.mjs
CHANGED
|
@@ -71304,7 +71304,7 @@ var init_version = __esm({
|
|
|
71304
71304
|
// dist/api/chat.js
|
|
71305
71305
|
function convertToOpenAIMessages(messages, includeBuiltinSystemPrompt = true, customSystemPromptOverride, planMode = false, vulnerabilityHuntingMode = false) {
|
|
71306
71306
|
var _a21;
|
|
71307
|
-
const
|
|
71307
|
+
const customSystemPrompts = customSystemPromptOverride;
|
|
71308
71308
|
let result2 = messages.map((msg) => {
|
|
71309
71309
|
if (msg.role === "user" && msg.images && msg.images.length > 0) {
|
|
71310
71310
|
const contentParts = [];
|
|
@@ -71383,12 +71383,15 @@ function convertToOpenAIMessages(messages, includeBuiltinSystemPrompt = true, cu
|
|
|
71383
71383
|
if (result2.length > 0 && ((_a21 = result2[0]) == null ? void 0 : _a21.role) === "system") {
|
|
71384
71384
|
return result2;
|
|
71385
71385
|
}
|
|
71386
|
-
if (
|
|
71386
|
+
if (customSystemPrompts && customSystemPrompts.length > 0) {
|
|
71387
71387
|
if (includeBuiltinSystemPrompt) {
|
|
71388
71388
|
result2 = [
|
|
71389
71389
|
{
|
|
71390
71390
|
role: "system",
|
|
71391
|
-
content:
|
|
71391
|
+
content: customSystemPrompts.map((text3) => ({
|
|
71392
|
+
type: "text",
|
|
71393
|
+
text: text3
|
|
71394
|
+
}))
|
|
71392
71395
|
},
|
|
71393
71396
|
{
|
|
71394
71397
|
role: "user",
|
|
@@ -71400,7 +71403,10 @@ function convertToOpenAIMessages(messages, includeBuiltinSystemPrompt = true, cu
|
|
|
71400
71403
|
result2 = [
|
|
71401
71404
|
{
|
|
71402
71405
|
role: "system",
|
|
71403
|
-
content:
|
|
71406
|
+
content: customSystemPrompts.map((text3) => ({
|
|
71407
|
+
type: "text",
|
|
71408
|
+
text: text3
|
|
71409
|
+
}))
|
|
71404
71410
|
},
|
|
71405
71411
|
...result2
|
|
71406
71412
|
];
|
|
@@ -71491,8 +71497,8 @@ async function* createStreamingChatCompletion(options3, abortSignal, onRetry) {
|
|
|
71491
71497
|
const { getSystemPromptConfig: getSystemPromptConfig2 } = await Promise.resolve().then(() => (init_apiConfig(), apiConfig_exports));
|
|
71492
71498
|
const systemPromptConfig = getSystemPromptConfig2();
|
|
71493
71499
|
const customPrompt = systemPromptConfig == null ? void 0 : systemPromptConfig.prompts.find((p) => p.id === options3.customSystemPromptId);
|
|
71494
|
-
if (customPrompt) {
|
|
71495
|
-
customSystemPromptContent = customPrompt.content;
|
|
71500
|
+
if (customPrompt == null ? void 0 : customPrompt.content) {
|
|
71501
|
+
customSystemPromptContent = [customPrompt.content];
|
|
71496
71502
|
}
|
|
71497
71503
|
}
|
|
71498
71504
|
customSystemPromptContent || (customSystemPromptContent = getCustomSystemPromptForConfig(config3));
|
|
@@ -71735,7 +71741,7 @@ function toResponseImageUrl(image3) {
|
|
|
71735
71741
|
return `data:${mimeType};base64,${data}`;
|
|
71736
71742
|
}
|
|
71737
71743
|
function convertToResponseInput(messages, includeBuiltinSystemPrompt = true, customSystemPromptOverride, planMode = false, vulnerabilityHuntingMode = false) {
|
|
71738
|
-
const
|
|
71744
|
+
const customSystemPrompts = customSystemPromptOverride;
|
|
71739
71745
|
const result2 = [];
|
|
71740
71746
|
for (const msg of messages) {
|
|
71741
71747
|
if (!msg)
|
|
@@ -71833,8 +71839,8 @@ function convertToResponseInput(messages, includeBuiltinSystemPrompt = true, cus
|
|
|
71833
71839
|
}
|
|
71834
71840
|
}
|
|
71835
71841
|
let systemInstructions;
|
|
71836
|
-
if (
|
|
71837
|
-
systemInstructions =
|
|
71842
|
+
if (customSystemPrompts && customSystemPrompts.length > 0) {
|
|
71843
|
+
systemInstructions = customSystemPrompts.join("\n\n");
|
|
71838
71844
|
if (includeBuiltinSystemPrompt) {
|
|
71839
71845
|
result2.unshift({
|
|
71840
71846
|
type: "message",
|
|
@@ -71927,8 +71933,8 @@ async function* createStreamingResponse(options3, abortSignal, onRetry) {
|
|
|
71927
71933
|
const { getSystemPromptConfig: getSystemPromptConfig2 } = await Promise.resolve().then(() => (init_apiConfig(), apiConfig_exports));
|
|
71928
71934
|
const systemPromptConfig = getSystemPromptConfig2();
|
|
71929
71935
|
const customPrompt = systemPromptConfig == null ? void 0 : systemPromptConfig.prompts.find((p) => p.id === options3.customSystemPromptId);
|
|
71930
|
-
if (customPrompt) {
|
|
71931
|
-
customSystemPromptContent = customPrompt.content;
|
|
71936
|
+
if (customPrompt == null ? void 0 : customPrompt.content) {
|
|
71937
|
+
customSystemPromptContent = [customPrompt.content];
|
|
71932
71938
|
}
|
|
71933
71939
|
}
|
|
71934
71940
|
customSystemPromptContent || (customSystemPromptContent = getCustomSystemPromptForConfig(config3));
|
|
@@ -72203,7 +72209,7 @@ function convertToolsToGemini(tools) {
|
|
|
72203
72209
|
}
|
|
72204
72210
|
function convertToGeminiMessages(messages, includeBuiltinSystemPrompt = true, customSystemPromptOverride, planMode = false, vulnerabilityHuntingMode = false) {
|
|
72205
72211
|
var _a21;
|
|
72206
|
-
const
|
|
72212
|
+
const customSystemPrompts = customSystemPromptOverride;
|
|
72207
72213
|
let systemInstruction;
|
|
72208
72214
|
const contents = [];
|
|
72209
72215
|
const toolCallIdToFunctionName = /* @__PURE__ */ new Map();
|
|
@@ -72212,7 +72218,7 @@ function convertToGeminiMessages(messages, includeBuiltinSystemPrompt = true, cu
|
|
|
72212
72218
|
if (!msg)
|
|
72213
72219
|
continue;
|
|
72214
72220
|
if (msg.role === "system") {
|
|
72215
|
-
systemInstruction = msg.content;
|
|
72221
|
+
systemInstruction = [msg.content];
|
|
72216
72222
|
continue;
|
|
72217
72223
|
}
|
|
72218
72224
|
if (msg.role === "assistant" && msg.tool_calls && msg.tool_calls.length > 0) {
|
|
@@ -72335,8 +72341,8 @@ function convertToGeminiMessages(messages, includeBuiltinSystemPrompt = true, cu
|
|
|
72335
72341
|
const role = msg.role === "assistant" ? "model" : "user";
|
|
72336
72342
|
contents.push({ role, parts });
|
|
72337
72343
|
}
|
|
72338
|
-
if (
|
|
72339
|
-
systemInstruction =
|
|
72344
|
+
if (customSystemPrompts && customSystemPrompts.length > 0) {
|
|
72345
|
+
systemInstruction = customSystemPrompts;
|
|
72340
72346
|
if (includeBuiltinSystemPrompt) {
|
|
72341
72347
|
contents.unshift({
|
|
72342
72348
|
role: "user",
|
|
@@ -72344,9 +72350,11 @@ function convertToGeminiMessages(messages, includeBuiltinSystemPrompt = true, cu
|
|
|
72344
72350
|
{ text: getSystemPromptForMode(planMode, vulnerabilityHuntingMode) }
|
|
72345
72351
|
]
|
|
72346
72352
|
});
|
|
72347
|
-
} else if (!systemInstruction && includeBuiltinSystemPrompt) {
|
|
72348
|
-
systemInstruction = getSystemPromptForMode(planMode, vulnerabilityHuntingMode);
|
|
72349
72353
|
}
|
|
72354
|
+
} else if (!systemInstruction && includeBuiltinSystemPrompt) {
|
|
72355
|
+
systemInstruction = [
|
|
72356
|
+
getSystemPromptForMode(planMode, vulnerabilityHuntingMode)
|
|
72357
|
+
];
|
|
72350
72358
|
}
|
|
72351
72359
|
return { systemInstruction, contents };
|
|
72352
72360
|
}
|
|
@@ -72376,8 +72384,8 @@ async function* createStreamingGeminiCompletion(options3, abortSignal, onRetry)
|
|
|
72376
72384
|
const { getSystemPromptConfig: getSystemPromptConfig2 } = await Promise.resolve().then(() => (init_apiConfig(), apiConfig_exports));
|
|
72377
72385
|
const systemPromptConfig = getSystemPromptConfig2();
|
|
72378
72386
|
const customPrompt = systemPromptConfig == null ? void 0 : systemPromptConfig.prompts.find((p) => p.id === options3.customSystemPromptId);
|
|
72379
|
-
if (customPrompt) {
|
|
72380
|
-
customSystemPromptContent = customPrompt.content;
|
|
72387
|
+
if (customPrompt == null ? void 0 : customPrompt.content) {
|
|
72388
|
+
customSystemPromptContent = [customPrompt.content];
|
|
72381
72389
|
}
|
|
72382
72390
|
}
|
|
72383
72391
|
customSystemPromptContent || (customSystemPromptContent = getCustomSystemPromptForConfig(config3));
|
|
@@ -72393,7 +72401,7 @@ async function* createStreamingGeminiCompletion(options3, abortSignal, onRetry)
|
|
|
72393
72401
|
);
|
|
72394
72402
|
const requestBody = {
|
|
72395
72403
|
contents,
|
|
72396
|
-
systemInstruction: systemInstruction ? { parts:
|
|
72404
|
+
systemInstruction: systemInstruction ? { parts: systemInstruction.map((text3) => ({ text: text3 })) } : void 0
|
|
72397
72405
|
};
|
|
72398
72406
|
if ((_a21 = config3.geminiThinking) == null ? void 0 : _a21.enabled) {
|
|
72399
72407
|
requestBody.generationConfig = {
|
|
@@ -73324,13 +73332,13 @@ Please provide your review in a clear, structured format.`;
|
|
|
73324
73332
|
if (!config3.advancedModel) {
|
|
73325
73333
|
throw new Error("Advanced model not configured");
|
|
73326
73334
|
}
|
|
73327
|
-
const
|
|
73335
|
+
const customSystemPrompts = getCustomSystemPrompt();
|
|
73328
73336
|
let processedMessages = messages;
|
|
73329
|
-
if (
|
|
73337
|
+
if (customSystemPrompts && customSystemPrompts.length > 0) {
|
|
73330
73338
|
processedMessages = [
|
|
73331
73339
|
{
|
|
73332
73340
|
role: "system",
|
|
73333
|
-
content:
|
|
73341
|
+
content: customSystemPrompts.join("\n\n")
|
|
73334
73342
|
},
|
|
73335
73343
|
...messages
|
|
73336
73344
|
];
|
|
@@ -74918,7 +74926,7 @@ function migrateSystemPromptFromTxt() {
|
|
|
74918
74926
|
return;
|
|
74919
74927
|
}
|
|
74920
74928
|
const config3 = {
|
|
74921
|
-
active: "default",
|
|
74929
|
+
active: ["default"],
|
|
74922
74930
|
prompts: [
|
|
74923
74931
|
{
|
|
74924
74932
|
id: "default",
|
|
@@ -74948,6 +74956,11 @@ function getSystemPromptConfig() {
|
|
|
74948
74956
|
return void 0;
|
|
74949
74957
|
}
|
|
74950
74958
|
const config3 = JSON.parse(content);
|
|
74959
|
+
if (typeof config3.active === "string") {
|
|
74960
|
+
config3.active = config3.active ? [config3.active] : [];
|
|
74961
|
+
} else if (!Array.isArray(config3.active)) {
|
|
74962
|
+
config3.active = [];
|
|
74963
|
+
}
|
|
74951
74964
|
return config3;
|
|
74952
74965
|
} catch (error) {
|
|
74953
74966
|
console.error("Failed to read system prompt config:", error);
|
|
@@ -74976,14 +74989,21 @@ function getCustomSystemPromptForConfig(apiConfig) {
|
|
|
74976
74989
|
return void 0;
|
|
74977
74990
|
}
|
|
74978
74991
|
if (systemPromptId) {
|
|
74979
|
-
const
|
|
74980
|
-
|
|
74992
|
+
const ids = Array.isArray(systemPromptId) ? systemPromptId : [systemPromptId];
|
|
74993
|
+
const contents2 = ids.map((id) => {
|
|
74994
|
+
var _a21;
|
|
74995
|
+
return (_a21 = config3.prompts.find((p) => p.id === id)) == null ? void 0 : _a21.content;
|
|
74996
|
+
}).filter((c) => typeof c === "string" && c.length > 0);
|
|
74997
|
+
return contents2.length > 0 ? contents2 : void 0;
|
|
74981
74998
|
}
|
|
74982
|
-
if (!config3.active) {
|
|
74999
|
+
if (!config3.active || config3.active.length === 0) {
|
|
74983
75000
|
return void 0;
|
|
74984
75001
|
}
|
|
74985
|
-
const
|
|
74986
|
-
|
|
75002
|
+
const contents = config3.active.map((id) => {
|
|
75003
|
+
var _a21;
|
|
75004
|
+
return (_a21 = config3.prompts.find((p) => p.id === id)) == null ? void 0 : _a21.content;
|
|
75005
|
+
}).filter((c) => typeof c === "string" && c.length > 0);
|
|
75006
|
+
return contents.length > 0 ? contents : void 0;
|
|
74987
75007
|
}
|
|
74988
75008
|
function getCustomHeaders() {
|
|
74989
75009
|
return getCustomHeadersForConfig(getOpenAiConfig());
|
|
@@ -75209,12 +75229,12 @@ function convertToolsToAnthropic(tools) {
|
|
|
75209
75229
|
}
|
|
75210
75230
|
function convertToAnthropicMessages(messages, includeBuiltinSystemPrompt = true, customSystemPromptOverride, cacheTTL = "5m", disableThinking = false, planMode = false, vulnerabilityHuntingMode = false) {
|
|
75211
75231
|
var _a21;
|
|
75212
|
-
const
|
|
75213
|
-
let
|
|
75232
|
+
const customSystemPrompts = customSystemPromptOverride;
|
|
75233
|
+
let systemContents;
|
|
75214
75234
|
const anthropicMessages = [];
|
|
75215
75235
|
for (const msg of messages) {
|
|
75216
75236
|
if (msg.role === "system") {
|
|
75217
|
-
|
|
75237
|
+
systemContents = [msg.content];
|
|
75218
75238
|
continue;
|
|
75219
75239
|
}
|
|
75220
75240
|
if (msg.role === "tool" && msg.tool_call_id) {
|
|
@@ -75342,8 +75362,8 @@ function convertToAnthropicMessages(messages, includeBuiltinSystemPrompt = true,
|
|
|
75342
75362
|
}
|
|
75343
75363
|
}
|
|
75344
75364
|
}
|
|
75345
|
-
if (
|
|
75346
|
-
|
|
75365
|
+
if (customSystemPrompts && customSystemPrompts.length > 0) {
|
|
75366
|
+
systemContents = customSystemPrompts;
|
|
75347
75367
|
if (includeBuiltinSystemPrompt) {
|
|
75348
75368
|
anthropicMessages.unshift({
|
|
75349
75369
|
role: "user",
|
|
@@ -75355,14 +75375,16 @@ function convertToAnthropicMessages(messages, includeBuiltinSystemPrompt = true,
|
|
|
75355
75375
|
}
|
|
75356
75376
|
]
|
|
75357
75377
|
});
|
|
75358
|
-
} else if (!systemContent && includeBuiltinSystemPrompt) {
|
|
75359
|
-
systemContent = getSystemPromptForMode(planMode, vulnerabilityHuntingMode);
|
|
75360
75378
|
}
|
|
75379
|
+
} else if (!systemContents && includeBuiltinSystemPrompt) {
|
|
75380
|
+
systemContents = [
|
|
75381
|
+
getSystemPromptForMode(planMode, vulnerabilityHuntingMode)
|
|
75382
|
+
];
|
|
75361
75383
|
}
|
|
75362
75384
|
let lastUserMessageIndex = -1;
|
|
75363
75385
|
for (let i = anthropicMessages.length - 1; i >= 0; i--) {
|
|
75364
75386
|
if (((_a21 = anthropicMessages[i]) == null ? void 0 : _a21.role) === "user") {
|
|
75365
|
-
if (
|
|
75387
|
+
if (customSystemPrompts && customSystemPrompts.length > 0 && i === 0) {
|
|
75366
75388
|
continue;
|
|
75367
75389
|
}
|
|
75368
75390
|
lastUserMessageIndex = i;
|
|
@@ -75389,13 +75411,11 @@ function convertToAnthropicMessages(messages, includeBuiltinSystemPrompt = true,
|
|
|
75389
75411
|
}
|
|
75390
75412
|
}
|
|
75391
75413
|
}
|
|
75392
|
-
const system =
|
|
75393
|
-
|
|
75394
|
-
|
|
75395
|
-
|
|
75396
|
-
|
|
75397
|
-
}
|
|
75398
|
-
] : void 0;
|
|
75414
|
+
const system = systemContents && systemContents.length > 0 ? systemContents.map((text3, index) => ({
|
|
75415
|
+
type: "text",
|
|
75416
|
+
text: text3,
|
|
75417
|
+
...index === systemContents.length - 1 ? { cache_control: { type: "ephemeral", ttl: cacheTTL } } : {}
|
|
75418
|
+
})) : void 0;
|
|
75399
75419
|
return { system, messages: anthropicMessages };
|
|
75400
75420
|
}
|
|
75401
75421
|
async function* parseSSEStream3(reader) {
|
|
@@ -75470,8 +75490,8 @@ async function* createStreamingAnthropicCompletion(options3, abortSignal, onRetr
|
|
|
75470
75490
|
const { getSystemPromptConfig: getSystemPromptConfig2 } = await Promise.resolve().then(() => (init_apiConfig(), apiConfig_exports));
|
|
75471
75491
|
const systemPromptConfig = getSystemPromptConfig2();
|
|
75472
75492
|
const customPrompt = systemPromptConfig == null ? void 0 : systemPromptConfig.prompts.find((p) => p.id === options3.customSystemPromptId);
|
|
75473
|
-
if (customPrompt) {
|
|
75474
|
-
customSystemPromptContent = customPrompt.content;
|
|
75493
|
+
if (customPrompt == null ? void 0 : customPrompt.content) {
|
|
75494
|
+
customSystemPromptContent = [customPrompt.content];
|
|
75475
75495
|
}
|
|
75476
75496
|
}
|
|
75477
75497
|
customSystemPromptContent || (customSystemPromptContent = getCustomSystemPromptForConfig(config3));
|
|
@@ -81079,19 +81099,19 @@ var init_en = __esm({
|
|
|
81079
81099
|
},
|
|
81080
81100
|
systemPromptConfig: {
|
|
81081
81101
|
title: "System Prompt Management",
|
|
81082
|
-
subtitle: "Manage multiple system prompts
|
|
81083
|
-
activePrompt: "Active
|
|
81102
|
+
subtitle: "Manage multiple system prompts (multi-select supported)",
|
|
81103
|
+
activePrompt: "Active Prompts:",
|
|
81084
81104
|
none: "None",
|
|
81085
81105
|
noPromptsConfigured: "No system prompts configured. Press Enter to add one.",
|
|
81086
81106
|
availablePrompts: "Available Prompts:",
|
|
81087
81107
|
actions: "Actions:",
|
|
81088
|
-
activate: "
|
|
81089
|
-
deactivate: "Deactivate",
|
|
81108
|
+
activate: "Toggle",
|
|
81109
|
+
deactivate: "Deactivate All",
|
|
81090
81110
|
edit: "Edit",
|
|
81091
81111
|
delete: "Delete",
|
|
81092
81112
|
addNew: "Add New",
|
|
81093
81113
|
escBack: "[ESC] Back",
|
|
81094
|
-
navigationHint: "
|
|
81114
|
+
navigationHint: "\u2191\u2193 Select prompt | Space Toggle | \u2190\u2192 Select action | Enter Confirm",
|
|
81095
81115
|
addNewTitle: "Add New System Prompt",
|
|
81096
81116
|
editTitle: "Edit System Prompt",
|
|
81097
81117
|
nameLabel: "Name:",
|
|
@@ -81108,7 +81128,8 @@ var init_en = __esm({
|
|
|
81108
81128
|
confirmDelete: "Confirm Delete",
|
|
81109
81129
|
deleteConfirmMessage: "Are you sure you want to delete",
|
|
81110
81130
|
confirmHint: "Press Y to confirm, N or ESC to cancel",
|
|
81111
|
-
saveError: "Failed to save"
|
|
81131
|
+
saveError: "Failed to save",
|
|
81132
|
+
activeCount: "{count} active"
|
|
81112
81133
|
},
|
|
81113
81134
|
configScreen: {
|
|
81114
81135
|
title: "API & Model Configuration",
|
|
@@ -81190,7 +81211,8 @@ var init_en = __esm({
|
|
|
81190
81211
|
followGlobal: "Follow Global: {name}",
|
|
81191
81212
|
followGlobalWithParentheses: "Follow Global ({name})",
|
|
81192
81213
|
followGlobalNoneWithParentheses: "Follow Global (None)",
|
|
81193
|
-
notUse: "Not Use"
|
|
81214
|
+
notUse: "Not Use",
|
|
81215
|
+
systemPromptMultiSelectHint: "Space: toggle | Enter: confirm | Esc: cancel"
|
|
81194
81216
|
},
|
|
81195
81217
|
customHeaders: {
|
|
81196
81218
|
title: "Custom Headers Management",
|
|
@@ -82344,19 +82366,19 @@ var init_zh = __esm({
|
|
|
82344
82366
|
},
|
|
82345
82367
|
systemPromptConfig: {
|
|
82346
82368
|
title: "\u7CFB\u7EDF\u63D0\u793A\u8BCD\u7BA1\u7406",
|
|
82347
|
-
subtitle: "\u7BA1\u7406\u591A\u4E2A\u7CFB\u7EDF\u63D0\u793A\u8BCD\
|
|
82348
|
-
activePrompt: "\u6D3B\
|
|
82369
|
+
subtitle: "\u7BA1\u7406\u591A\u4E2A\u7CFB\u7EDF\u63D0\u793A\u8BCD\uFF08\u652F\u6301\u591A\u9009\u6FC0\u6D3B\uFF09",
|
|
82370
|
+
activePrompt: "\u5DF2\u6FC0\u6D3B\u63D0\u793A\u8BCD:",
|
|
82349
82371
|
none: "\u65E0",
|
|
82350
82372
|
noPromptsConfigured: "\u672A\u914D\u7F6E\u7CFB\u7EDF\u63D0\u793A\u8BCD\u3002\u6309 Enter \u6DFB\u52A0\u4E00\u4E2A\u3002",
|
|
82351
82373
|
availablePrompts: "\u53EF\u7528\u63D0\u793A\u8BCD:",
|
|
82352
82374
|
actions: "\u64CD\u4F5C:",
|
|
82353
|
-
activate: "\u6FC0\u6D3B",
|
|
82354
|
-
deactivate: "\u505C\u7528",
|
|
82375
|
+
activate: "\u5207\u6362\u6FC0\u6D3B",
|
|
82376
|
+
deactivate: "\u5168\u90E8\u505C\u7528",
|
|
82355
82377
|
edit: "\u7F16\u8F91",
|
|
82356
82378
|
delete: "\u5220\u9664",
|
|
82357
82379
|
addNew: "\u6DFB\u52A0\u65B0\u63D0\u793A\u8BCD",
|
|
82358
82380
|
escBack: "[ESC] \u8FD4\u56DE",
|
|
82359
|
-
navigationHint: "\
|
|
82381
|
+
navigationHint: "\u2191\u2193 \u9009\u62E9\u63D0\u793A\u8BCD | \u7A7A\u683C \u5207\u6362\u6FC0\u6D3B | \u2190\u2192 \u9009\u62E9\u64CD\u4F5C | Enter \u786E\u8BA4",
|
|
82360
82382
|
addNewTitle: "\u6DFB\u52A0\u65B0\u7CFB\u7EDF\u63D0\u793A\u8BCD",
|
|
82361
82383
|
editTitle: "\u7F16\u8F91\u7CFB\u7EDF\u63D0\u793A\u8BCD",
|
|
82362
82384
|
nameLabel: "\u540D\u79F0:",
|
|
@@ -82373,7 +82395,8 @@ var init_zh = __esm({
|
|
|
82373
82395
|
confirmDelete: "\u786E\u8BA4\u5220\u9664",
|
|
82374
82396
|
deleteConfirmMessage: "\u786E\u5B9A\u8981\u5220\u9664",
|
|
82375
82397
|
confirmHint: "\u6309 Y \u786E\u8BA4,N \u6216 ESC \u53D6\u6D88",
|
|
82376
|
-
saveError: "\u4FDD\u5B58\u5931\u8D25"
|
|
82398
|
+
saveError: "\u4FDD\u5B58\u5931\u8D25",
|
|
82399
|
+
activeCount: "\u5DF2\u6FC0\u6D3B {count} \u4E2A"
|
|
82377
82400
|
},
|
|
82378
82401
|
configScreen: {
|
|
82379
82402
|
title: "API \u548C\u6A21\u578B\u914D\u7F6E",
|
|
@@ -82455,7 +82478,8 @@ var init_zh = __esm({
|
|
|
82455
82478
|
followGlobal: "\u8DDF\u968F\u5168\u5C40\uFF1A{name}",
|
|
82456
82479
|
followGlobalWithParentheses: "\u8DDF\u968F\u5168\u5C40\uFF08{name}\uFF09",
|
|
82457
82480
|
followGlobalNoneWithParentheses: "\u8DDF\u968F\u5168\u5C40\uFF08\u65E0\uFF09",
|
|
82458
|
-
notUse: "\u4E0D\u4F7F\u7528"
|
|
82481
|
+
notUse: "\u4E0D\u4F7F\u7528",
|
|
82482
|
+
systemPromptMultiSelectHint: "\u7A7A\u683C: \u5207\u6362\u9009\u4E2D | Enter: \u786E\u8BA4 | Esc: \u53D6\u6D88"
|
|
82459
82483
|
},
|
|
82460
82484
|
customHeaders: {
|
|
82461
82485
|
title: "\u81EA\u5B9A\u4E49\u8BF7\u6C42\u5934\u7BA1\u7406",
|
|
@@ -83608,19 +83632,19 @@ var init_zh_TW = __esm({
|
|
|
83608
83632
|
},
|
|
83609
83633
|
systemPromptConfig: {
|
|
83610
83634
|
title: "\u7CFB\u7D71\u63D0\u793A\u8A5E\u7BA1\u7406",
|
|
83611
|
-
subtitle: "\u7BA1\u7406\u591A\u500B\u7CFB\u7D71\u63D0\u793A\u8A5E\
|
|
83612
|
-
activePrompt: "\
|
|
83635
|
+
subtitle: "\u7BA1\u7406\u591A\u500B\u7CFB\u7D71\u63D0\u793A\u8A5E\uFF08\u652F\u63F4\u591A\u9078\u555F\u7528\uFF09",
|
|
83636
|
+
activePrompt: "\u5DF2\u555F\u7528\u63D0\u793A\u8A5E:",
|
|
83613
83637
|
none: "\u7121",
|
|
83614
83638
|
noPromptsConfigured: "\u672A\u914D\u7F6E\u7CFB\u7D71\u63D0\u793A\u8A5E\u3002\u6309 Enter \u65B0\u589E\u4E00\u500B\u3002",
|
|
83615
83639
|
availablePrompts: "\u53EF\u7528\u63D0\u793A\u8A5E:",
|
|
83616
83640
|
actions: "\u64CD\u4F5C:",
|
|
83617
|
-
activate: "\u555F\u7528",
|
|
83618
|
-
deactivate: "\u505C\u7528",
|
|
83641
|
+
activate: "\u5207\u63DB\u555F\u7528",
|
|
83642
|
+
deactivate: "\u5168\u90E8\u505C\u7528",
|
|
83619
83643
|
edit: "\u7DE8\u8F2F",
|
|
83620
83644
|
delete: "\u522A\u9664",
|
|
83621
83645
|
addNew: "\u65B0\u589E\u65B0\u63D0\u793A\u8A5E",
|
|
83622
83646
|
escBack: "[ESC] \u8FD4\u56DE",
|
|
83623
|
-
navigationHint: "\
|
|
83647
|
+
navigationHint: "\u2191\u2193 \u9078\u64C7\u63D0\u793A\u8A5E | \u7A7A\u683C \u5207\u63DB\u555F\u7528 | \u2190\u2192 \u9078\u64C7\u64CD\u4F5C | Enter \u78BA\u8A8D",
|
|
83624
83648
|
addNewTitle: "\u65B0\u589E\u65B0\u7CFB\u7D71\u63D0\u793A\u8A5E",
|
|
83625
83649
|
editTitle: "\u7DE8\u8F2F\u7CFB\u7D71\u63D0\u793A\u8A5E",
|
|
83626
83650
|
nameLabel: "\u540D\u7A31:",
|
|
@@ -83637,7 +83661,8 @@ var init_zh_TW = __esm({
|
|
|
83637
83661
|
confirmDelete: "\u78BA\u8A8D\u522A\u9664",
|
|
83638
83662
|
deleteConfirmMessage: "\u78BA\u5B9A\u8981\u522A\u9664",
|
|
83639
83663
|
confirmHint: "\u6309 Y \u78BA\u8A8D,N \u6216 ESC \u53D6\u6D88",
|
|
83640
|
-
saveError: "\u5132\u5B58\u5931\u6557"
|
|
83664
|
+
saveError: "\u5132\u5B58\u5931\u6557",
|
|
83665
|
+
activeCount: "\u5DF2\u555F\u7528 {count} \u500B"
|
|
83641
83666
|
},
|
|
83642
83667
|
configScreen: {
|
|
83643
83668
|
title: "API \u548C\u6A21\u578B\u914D\u7F6E",
|
|
@@ -83719,7 +83744,8 @@ var init_zh_TW = __esm({
|
|
|
83719
83744
|
followGlobal: "\u8DDF\u96A8\u5168\u57DF\uFF1A{name}",
|
|
83720
83745
|
followGlobalWithParentheses: "\u8DDF\u96A8\u5168\u57DF\uFF08{name}\uFF09",
|
|
83721
83746
|
followGlobalNoneWithParentheses: "\u8DDF\u96A8\u5168\u57DF\uFF08\u7121\uFF09",
|
|
83722
|
-
notUse: "\u4E0D\u4F7F\u7528"
|
|
83747
|
+
notUse: "\u4E0D\u4F7F\u7528",
|
|
83748
|
+
systemPromptMultiSelectHint: "\u7A7A\u683C: \u5207\u63DB\u9078\u4E2D | Enter: \u78BA\u8A8D | Esc: \u53D6\u6D88"
|
|
83723
83749
|
},
|
|
83724
83750
|
customHeaders: {
|
|
83725
83751
|
title: "\u81EA\u8A02\u8ACB\u6C42\u982D\u7BA1\u7406",
|
|
@@ -89902,7 +89928,8 @@ function ConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
89902
89928
|
const [systemPromptId, setSystemPromptId] = (0, import_react64.useState)(void 0);
|
|
89903
89929
|
const [customHeadersSchemeId, setCustomHeadersSchemeId] = (0, import_react64.useState)(void 0);
|
|
89904
89930
|
const [systemPrompts, setSystemPrompts] = (0, import_react64.useState)([]);
|
|
89905
|
-
const [
|
|
89931
|
+
const [activeSystemPromptIds, setActiveSystemPromptIds] = (0, import_react64.useState)([]);
|
|
89932
|
+
const [pendingPromptIds, setPendingPromptIds] = (0, import_react64.useState)(/* @__PURE__ */ new Set());
|
|
89906
89933
|
const [customHeaderSchemes, setCustomHeaderSchemes] = (0, import_react64.useState)([]);
|
|
89907
89934
|
const [activeCustomHeadersSchemeId, setActiveCustomHeadersSchemeId] = (0, import_react64.useState)("");
|
|
89908
89935
|
const [anthropicBeta, setAnthropicBeta] = (0, import_react64.useState)(false);
|
|
@@ -90060,7 +90087,7 @@ function ConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
90060
90087
|
setEditSimilarityThreshold(config3.editSimilarityThreshold ?? 0.75);
|
|
90061
90088
|
const systemPromptConfig = getSystemPromptConfig();
|
|
90062
90089
|
setSystemPrompts(((systemPromptConfig == null ? void 0 : systemPromptConfig.prompts) || []).map((p) => ({ id: p.id, name: p.name })));
|
|
90063
|
-
|
|
90090
|
+
setActiveSystemPromptIds((systemPromptConfig == null ? void 0 : systemPromptConfig.active) || []);
|
|
90064
90091
|
const customHeadersConfig = getCustomHeadersConfig();
|
|
90065
90092
|
setCustomHeaderSchemes(((customHeadersConfig == null ? void 0 : customHeadersConfig.schemes) || []).map((s) => ({ id: s.id, name: s.name })));
|
|
90066
90093
|
setActiveCustomHeadersSchemeId((customHeadersConfig == null ? void 0 : customHeadersConfig.active) || "");
|
|
@@ -90165,7 +90192,8 @@ function ConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
90165
90192
|
return `${resolvedBaseUrl}/chat/completions`;
|
|
90166
90193
|
};
|
|
90167
90194
|
const getSystemPromptSelectItems = () => {
|
|
90168
|
-
const
|
|
90195
|
+
const activeNames = activeSystemPromptIds.map((id) => getSystemPromptNameById(id)).join(", ");
|
|
90196
|
+
const activeLabel = activeNames ? t.configScreen.followGlobalWithParentheses.replace("{name}", activeNames) : t.configScreen.followGlobalNoneWithParentheses;
|
|
90169
90197
|
return [
|
|
90170
90198
|
{ label: activeLabel, value: "__FOLLOW__" },
|
|
90171
90199
|
{ label: t.configScreen.notUse, value: "__DISABLED__" },
|
|
@@ -90178,6 +90206,8 @@ function ConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
90178
90206
|
const getSystemPromptSelectedValue = () => {
|
|
90179
90207
|
if (systemPromptId === "")
|
|
90180
90208
|
return "__DISABLED__";
|
|
90209
|
+
if (Array.isArray(systemPromptId))
|
|
90210
|
+
return "__FOLLOW__";
|
|
90181
90211
|
if (systemPromptId)
|
|
90182
90212
|
return systemPromptId;
|
|
90183
90213
|
return "__FOLLOW__";
|
|
@@ -90473,10 +90503,13 @@ function ConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
90473
90503
|
let display = t.configScreen.followGlobalNone;
|
|
90474
90504
|
if (systemPromptId === "") {
|
|
90475
90505
|
display = t.configScreen.notUse;
|
|
90476
|
-
} else if (systemPromptId) {
|
|
90506
|
+
} else if (Array.isArray(systemPromptId) && systemPromptId.length > 0) {
|
|
90507
|
+
display = systemPromptId.map((id) => getSystemPromptNameById(id)).join(", ");
|
|
90508
|
+
} else if (systemPromptId && typeof systemPromptId === "string") {
|
|
90477
90509
|
display = getSystemPromptNameById(systemPromptId);
|
|
90478
|
-
} else if (
|
|
90479
|
-
|
|
90510
|
+
} else if (activeSystemPromptIds.length > 0) {
|
|
90511
|
+
const activeNames = activeSystemPromptIds.map((id) => getSystemPromptNameById(id)).join(", ");
|
|
90512
|
+
display = t.configScreen.followGlobal.replace("{name}", activeNames);
|
|
90480
90513
|
}
|
|
90481
90514
|
return import_react64.default.createElement(
|
|
90482
90515
|
Box_default,
|
|
@@ -90991,6 +91024,9 @@ function ConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
90991
91024
|
if (isEditing && (currentField === "profile" || currentField === "requestMethod" || currentField === "systemPromptId" || currentField === "customHeadersSchemeId" || currentField === "anthropicCacheTTL" || currentField === "advancedModel" || currentField === "basicModel" || currentField === "responsesReasoningEffort") && key.escape) {
|
|
90992
91025
|
setIsEditing(false);
|
|
90993
91026
|
setSearchTerm("");
|
|
91027
|
+
if (currentField === "systemPromptId") {
|
|
91028
|
+
setPendingPromptIds(/* @__PURE__ */ new Set());
|
|
91029
|
+
}
|
|
90994
91030
|
forceUpdate((prev) => prev + 1);
|
|
90995
91031
|
return;
|
|
90996
91032
|
}
|
|
@@ -91130,6 +91166,15 @@ function ConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
91130
91166
|
setManualInputValue(getCurrentValue());
|
|
91131
91167
|
});
|
|
91132
91168
|
} else {
|
|
91169
|
+
if (currentField === "systemPromptId") {
|
|
91170
|
+
if (Array.isArray(systemPromptId)) {
|
|
91171
|
+
setPendingPromptIds(new Set(systemPromptId));
|
|
91172
|
+
} else if (systemPromptId && systemPromptId !== "") {
|
|
91173
|
+
setPendingPromptIds(/* @__PURE__ */ new Set([systemPromptId]));
|
|
91174
|
+
} else {
|
|
91175
|
+
setPendingPromptIds(/* @__PURE__ */ new Set());
|
|
91176
|
+
}
|
|
91177
|
+
}
|
|
91133
91178
|
setIsEditing(true);
|
|
91134
91179
|
}
|
|
91135
91180
|
}
|
|
@@ -91459,10 +91504,54 @@ function ConfigScreen({ onBack, onSave, inlineMode = false }) {
|
|
|
91459
91504
|
currentField === "systemPromptId" && (() => {
|
|
91460
91505
|
const items = getSystemPromptSelectItems();
|
|
91461
91506
|
const selected = getSystemPromptSelectedValue();
|
|
91462
|
-
return import_react64.default.createElement(
|
|
91463
|
-
|
|
91464
|
-
|
|
91465
|
-
|
|
91507
|
+
return import_react64.default.createElement(
|
|
91508
|
+
Box_default,
|
|
91509
|
+
{ flexDirection: "column" },
|
|
91510
|
+
import_react64.default.createElement(ScrollableSelectInput, { items, limit: 10, initialIndex: Math.max(0, items.findIndex((opt) => opt.value === selected)), isFocused: true, selectedValues: pendingPromptIds, renderItem: ({ label, value, isSelected, isMarked }) => {
|
|
91511
|
+
const isMeta = value === "__FOLLOW__" || value === "__DISABLED__";
|
|
91512
|
+
return import_react64.default.createElement(
|
|
91513
|
+
Text,
|
|
91514
|
+
{ color: isSelected ? "cyan" : isMarked ? theme14.colors.menuInfo : "white" },
|
|
91515
|
+
isMeta ? "" : isMarked ? "[x] " : "[ ] ",
|
|
91516
|
+
label
|
|
91517
|
+
);
|
|
91518
|
+
}, onToggleItem: (item) => {
|
|
91519
|
+
if (item.value === "__FOLLOW__" || item.value === "__DISABLED__") {
|
|
91520
|
+
applySystemPromptSelectValue(item.value);
|
|
91521
|
+
setPendingPromptIds(/* @__PURE__ */ new Set());
|
|
91522
|
+
setIsEditing(false);
|
|
91523
|
+
return;
|
|
91524
|
+
}
|
|
91525
|
+
setPendingPromptIds((prev) => {
|
|
91526
|
+
const next = new Set(prev);
|
|
91527
|
+
if (next.has(item.value)) {
|
|
91528
|
+
next.delete(item.value);
|
|
91529
|
+
} else {
|
|
91530
|
+
next.add(item.value);
|
|
91531
|
+
}
|
|
91532
|
+
return next;
|
|
91533
|
+
});
|
|
91534
|
+
}, onSelect: (item) => {
|
|
91535
|
+
if (item.value === "__FOLLOW__" || item.value === "__DISABLED__") {
|
|
91536
|
+
applySystemPromptSelectValue(item.value);
|
|
91537
|
+
setPendingPromptIds(/* @__PURE__ */ new Set());
|
|
91538
|
+
setIsEditing(false);
|
|
91539
|
+
return;
|
|
91540
|
+
}
|
|
91541
|
+
const finalIds = pendingPromptIds.size > 0 ? Array.from(pendingPromptIds) : [item.value];
|
|
91542
|
+
if (pendingPromptIds.size > 0 && !pendingPromptIds.has(item.value)) {
|
|
91543
|
+
finalIds.push(item.value);
|
|
91544
|
+
}
|
|
91545
|
+
setSystemPromptId(finalIds.length === 1 ? finalIds[0] : finalIds);
|
|
91546
|
+
setPendingPromptIds(/* @__PURE__ */ new Set());
|
|
91547
|
+
setIsEditing(false);
|
|
91548
|
+
} }),
|
|
91549
|
+
import_react64.default.createElement(
|
|
91550
|
+
Box_default,
|
|
91551
|
+
{ marginTop: 1 },
|
|
91552
|
+
import_react64.default.createElement(Text, { color: theme14.colors.menuSecondary, dimColor: true }, t.configScreen.systemPromptMultiSelectHint || "Space: toggle | Enter: confirm | Esc: cancel")
|
|
91553
|
+
)
|
|
91554
|
+
);
|
|
91466
91555
|
})(),
|
|
91467
91556
|
currentField === "customHeadersSchemeId" && (() => {
|
|
91468
91557
|
const items = getCustomHeadersSchemeSelectItems();
|
|
@@ -442348,20 +442437,33 @@ var init_sessionManager = __esm({
|
|
|
442348
442437
|
if (!this.currentSession || this.currentSession.messages.length < 2) {
|
|
442349
442438
|
return;
|
|
442350
442439
|
}
|
|
442440
|
+
const targetSession = this.currentSession;
|
|
442441
|
+
const targetSessionId = targetSession.id;
|
|
442351
442442
|
try {
|
|
442352
|
-
const firstUserMessage =
|
|
442353
|
-
const firstAssistantMessage =
|
|
442443
|
+
const firstUserMessage = targetSession.messages.find((m) => m.role === "user");
|
|
442444
|
+
const firstAssistantMessage = targetSession.messages.find((m) => m.role === "assistant");
|
|
442354
442445
|
if (!firstUserMessage || !firstAssistantMessage) {
|
|
442355
442446
|
logger.warn("Summary agent: Could not find first user/assistant messages");
|
|
442356
442447
|
return;
|
|
442357
442448
|
}
|
|
442358
442449
|
const result2 = await summaryAgent.generateSummary(firstUserMessage.content, firstAssistantMessage.content);
|
|
442359
442450
|
if (result2) {
|
|
442360
|
-
this.currentSession.
|
|
442361
|
-
|
|
442362
|
-
|
|
442451
|
+
if (!this.currentSession || this.currentSession.id !== targetSessionId) {
|
|
442452
|
+
targetSession.title = result2.title;
|
|
442453
|
+
targetSession.summary = result2.summary;
|
|
442454
|
+
await this.saveSession(targetSession);
|
|
442455
|
+
logger.info("Summary agent: Updated detached session summary", {
|
|
442456
|
+
sessionId: targetSessionId,
|
|
442457
|
+
title: result2.title,
|
|
442458
|
+
summary: result2.summary
|
|
442459
|
+
});
|
|
442460
|
+
return;
|
|
442461
|
+
}
|
|
442462
|
+
targetSession.title = result2.title;
|
|
442463
|
+
targetSession.summary = result2.summary;
|
|
442464
|
+
await this.saveSession(targetSession);
|
|
442363
442465
|
logger.info("Summary agent: Successfully updated session summary", {
|
|
442364
|
-
sessionId:
|
|
442466
|
+
sessionId: targetSessionId,
|
|
442365
442467
|
title: result2.title,
|
|
442366
442468
|
summary: result2.summary
|
|
442367
442469
|
});
|
|
@@ -459330,7 +459432,7 @@ function SystemPromptConfigScreen({ onBack }) {
|
|
|
459330
459432
|
const { theme: theme14 } = useTheme();
|
|
459331
459433
|
const [config3, setConfig] = (0, import_react72.useState)(() => {
|
|
459332
459434
|
return getSystemPromptConfig() || {
|
|
459333
|
-
active:
|
|
459435
|
+
active: [],
|
|
459334
459436
|
prompts: []
|
|
459335
459437
|
};
|
|
459336
459438
|
});
|
|
@@ -459343,7 +459445,7 @@ function SystemPromptConfigScreen({ onBack }) {
|
|
|
459343
459445
|
const [editingField, setEditingField] = (0, import_react72.useState)("name");
|
|
459344
459446
|
const [error, setError] = (0, import_react72.useState)("");
|
|
459345
459447
|
const [successMessage, setSuccessMessage] = (0, import_react72.useState)("");
|
|
459346
|
-
const actions = config3.prompts.length > 0 ? config3.active ? ["activate", "deactivate", "edit", "delete", "add", "back"] : ["activate", "edit", "delete", "add", "back"] : ["add", "back"];
|
|
459448
|
+
const actions = config3.prompts.length > 0 ? config3.active.length > 0 ? ["activate", "deactivate", "edit", "delete", "add", "back"] : ["activate", "edit", "delete", "add", "back"] : ["add", "back"];
|
|
459347
459449
|
(0, import_react72.useEffect)(() => {
|
|
459348
459450
|
if (!actions.includes(currentAction)) {
|
|
459349
459451
|
setCurrentAction(actions[0] || "add");
|
|
@@ -459370,9 +459472,11 @@ function SystemPromptConfigScreen({ onBack }) {
|
|
|
459370
459472
|
if (config3.prompts.length === 0 || selectedIndex >= config3.prompts.length)
|
|
459371
459473
|
return;
|
|
459372
459474
|
const prompt = config3.prompts[selectedIndex];
|
|
459475
|
+
const isAlreadyActive = config3.active.includes(prompt.id);
|
|
459476
|
+
const newActive = isAlreadyActive ? config3.active.filter((id) => id !== prompt.id) : [...config3.active, prompt.id];
|
|
459373
459477
|
const newConfig = {
|
|
459374
459478
|
...config3,
|
|
459375
|
-
active:
|
|
459479
|
+
active: newActive
|
|
459376
459480
|
};
|
|
459377
459481
|
if (saveAndRefresh(newConfig)) {
|
|
459378
459482
|
setError("");
|
|
@@ -459381,7 +459485,7 @@ function SystemPromptConfigScreen({ onBack }) {
|
|
|
459381
459485
|
const handleDeactivate = () => {
|
|
459382
459486
|
const newConfig = {
|
|
459383
459487
|
...config3,
|
|
459384
|
-
active:
|
|
459488
|
+
active: []
|
|
459385
459489
|
};
|
|
459386
459490
|
if (saveAndRefresh(newConfig)) {
|
|
459387
459491
|
setError("");
|
|
@@ -459457,7 +459561,7 @@ function SystemPromptConfigScreen({ onBack }) {
|
|
|
459457
459561
|
return;
|
|
459458
459562
|
const promptToDelete = config3.prompts[selectedIndex];
|
|
459459
459563
|
const newPrompts = config3.prompts.filter((_3, i) => i !== selectedIndex);
|
|
459460
|
-
const newActive = config3.active
|
|
459564
|
+
const newActive = config3.active.filter((id) => id !== promptToDelete.id);
|
|
459461
459565
|
const newConfig = {
|
|
459462
459566
|
active: newActive,
|
|
459463
459567
|
prompts: newPrompts
|
|
@@ -459483,7 +459587,7 @@ function SystemPromptConfigScreen({ onBack }) {
|
|
|
459483
459587
|
const newConfig = {
|
|
459484
459588
|
...config3,
|
|
459485
459589
|
prompts: [...config3.prompts, newPrompt],
|
|
459486
|
-
active: config3.prompts.length === 0 ? newPrompt.id : config3.active
|
|
459590
|
+
active: config3.prompts.length === 0 ? [newPrompt.id] : config3.active
|
|
459487
459591
|
};
|
|
459488
459592
|
if (saveAndRefresh(newConfig)) {
|
|
459489
459593
|
setView("list");
|
|
@@ -459518,6 +459622,8 @@ function SystemPromptConfigScreen({ onBack }) {
|
|
|
459518
459622
|
if (config3.prompts.length > 0) {
|
|
459519
459623
|
setSelectedIndex((prev) => prev < config3.prompts.length - 1 ? prev + 1 : 0);
|
|
459520
459624
|
}
|
|
459625
|
+
} else if (_input === " ") {
|
|
459626
|
+
handleActivate();
|
|
459521
459627
|
} else if (key.leftArrow) {
|
|
459522
459628
|
const currentIdx = actions.indexOf(currentAction);
|
|
459523
459629
|
setCurrentAction(actions[currentIdx > 0 ? currentIdx - 1 : actions.length - 1]);
|
|
@@ -459578,7 +459684,10 @@ function SystemPromptConfigScreen({ onBack }) {
|
|
|
459578
459684
|
}
|
|
459579
459685
|
}, { isActive: view === "confirmDelete" });
|
|
459580
459686
|
if (view === "list") {
|
|
459581
|
-
const
|
|
459687
|
+
const activePromptNames = config3.active.map((id) => {
|
|
459688
|
+
var _a21;
|
|
459689
|
+
return (_a21 = config3.prompts.find((p) => p.id === id)) == null ? void 0 : _a21.name;
|
|
459690
|
+
}).filter(Boolean).join(", ");
|
|
459582
459691
|
return import_react72.default.createElement(
|
|
459583
459692
|
Box_default,
|
|
459584
459693
|
{ flexDirection: "column", padding: 1 },
|
|
@@ -459595,7 +459704,15 @@ function SystemPromptConfigScreen({ onBack }) {
|
|
|
459595
459704
|
{ bold: true },
|
|
459596
459705
|
t.systemPromptConfig.activePrompt,
|
|
459597
459706
|
" ",
|
|
459598
|
-
import_react72.default.createElement(Text, { color: theme14.colors.success },
|
|
459707
|
+
import_react72.default.createElement(Text, { color: theme14.colors.success }, activePromptNames || t.systemPromptConfig.none),
|
|
459708
|
+
config3.active.length > 0 && import_react72.default.createElement(
|
|
459709
|
+
Text,
|
|
459710
|
+
{ dimColor: true },
|
|
459711
|
+
" ",
|
|
459712
|
+
"(",
|
|
459713
|
+
t.systemPromptConfig.activeCount.replace("{count}", String(config3.active.length)),
|
|
459714
|
+
")"
|
|
459715
|
+
)
|
|
459599
459716
|
)
|
|
459600
459717
|
),
|
|
459601
459718
|
config3.prompts.length === 0 ? import_react72.default.createElement(
|
|
@@ -459611,11 +459728,11 @@ function SystemPromptConfigScreen({ onBack }) {
|
|
|
459611
459728
|
{ key: prompt.id, marginLeft: 2 },
|
|
459612
459729
|
import_react72.default.createElement(
|
|
459613
459730
|
Text,
|
|
459614
|
-
{ color: index === selectedIndex ? theme14.colors.menuSelected : prompt.id
|
|
459615
|
-
index === selectedIndex ? "
|
|
459616
|
-
prompt.id
|
|
459731
|
+
{ color: index === selectedIndex ? theme14.colors.menuSelected : config3.active.includes(prompt.id) ? theme14.colors.menuInfo : theme14.colors.menuNormal },
|
|
459732
|
+
index === selectedIndex ? "> " : " ",
|
|
459733
|
+
config3.active.includes(prompt.id) ? "[x] " : "[ ] ",
|
|
459617
459734
|
prompt.name,
|
|
459618
|
-
prompt.content && import_react72.default.createElement(
|
|
459735
|
+
typeof prompt.content === "string" && prompt.content.length > 0 && import_react72.default.createElement(
|
|
459619
459736
|
Text,
|
|
459620
459737
|
{ dimColor: true },
|
|
459621
459738
|
" ",
|
|
@@ -567637,10 +567754,10 @@ ${cleanThinkingContent2(msg.reasoning_content)}`);
|
|
|
567637
567754
|
}
|
|
567638
567755
|
return parts.length > 0 ? parts.join("\n") : null;
|
|
567639
567756
|
}
|
|
567640
|
-
function prepareMessagesForCompression(conversationMessages,
|
|
567757
|
+
function prepareMessagesForCompression(conversationMessages, customSystemPrompts) {
|
|
567641
567758
|
const messages = [];
|
|
567642
|
-
if (
|
|
567643
|
-
messages.push({ role: "system", content:
|
|
567759
|
+
if (customSystemPrompts && customSystemPrompts.length > 0) {
|
|
567760
|
+
messages.push({ role: "system", content: customSystemPrompts.join("\n\n") });
|
|
567644
567761
|
} else {
|
|
567645
567762
|
messages.push({
|
|
567646
567763
|
role: "system",
|
|
@@ -567670,8 +567787,8 @@ ${conversationTranscript}`
|
|
|
567670
567787
|
});
|
|
567671
567788
|
return messages;
|
|
567672
567789
|
}
|
|
567673
|
-
async function compressWithChatCompletions(modelName, conversationMessages,
|
|
567674
|
-
const messages = prepareMessagesForCompression(conversationMessages,
|
|
567790
|
+
async function compressWithChatCompletions(modelName, conversationMessages, customSystemPrompts) {
|
|
567791
|
+
const messages = prepareMessagesForCompression(conversationMessages, customSystemPrompts);
|
|
567675
567792
|
let summary = "";
|
|
567676
567793
|
let usage = {
|
|
567677
567794
|
prompt_tokens: 0,
|
|
@@ -567699,8 +567816,8 @@ async function compressWithChatCompletions(modelName, conversationMessages, cust
|
|
|
567699
567816
|
}
|
|
567700
567817
|
return { summary, usage };
|
|
567701
567818
|
}
|
|
567702
|
-
async function compressWithResponses(modelName, conversationMessages,
|
|
567703
|
-
const messages = prepareMessagesForCompression(conversationMessages,
|
|
567819
|
+
async function compressWithResponses(modelName, conversationMessages, customSystemPrompts) {
|
|
567820
|
+
const messages = prepareMessagesForCompression(conversationMessages, customSystemPrompts);
|
|
567704
567821
|
let summary = "";
|
|
567705
567822
|
let usage = {
|
|
567706
567823
|
prompt_tokens: 0,
|
|
@@ -567728,8 +567845,8 @@ async function compressWithResponses(modelName, conversationMessages, customSyst
|
|
|
567728
567845
|
}
|
|
567729
567846
|
return { summary, usage };
|
|
567730
567847
|
}
|
|
567731
|
-
async function compressWithGemini(modelName, conversationMessages,
|
|
567732
|
-
const messages = prepareMessagesForCompression(conversationMessages,
|
|
567848
|
+
async function compressWithGemini(modelName, conversationMessages, customSystemPrompts) {
|
|
567849
|
+
const messages = prepareMessagesForCompression(conversationMessages, customSystemPrompts);
|
|
567733
567850
|
let summary = "";
|
|
567734
567851
|
let usage = {
|
|
567735
567852
|
prompt_tokens: 0,
|
|
@@ -567756,8 +567873,8 @@ async function compressWithGemini(modelName, conversationMessages, customSystemP
|
|
|
567756
567873
|
}
|
|
567757
567874
|
return { summary, usage };
|
|
567758
567875
|
}
|
|
567759
|
-
async function compressWithAnthropic(modelName, conversationMessages,
|
|
567760
|
-
const messages = prepareMessagesForCompression(conversationMessages,
|
|
567876
|
+
async function compressWithAnthropic(modelName, conversationMessages, customSystemPrompts) {
|
|
567877
|
+
const messages = prepareMessagesForCompression(conversationMessages, customSystemPrompts);
|
|
567761
567878
|
let summary = "";
|
|
567762
567879
|
let usage = {
|
|
567763
567880
|
prompt_tokens: 0,
|
|
@@ -568424,6 +568541,8 @@ Output: ${combinedOutput}`;
|
|
|
568424
568541
|
} else if (result2.success && result2.action === "showProfilePanel") {
|
|
568425
568542
|
options3.onSwitchProfile();
|
|
568426
568543
|
} else if (result2.success && result2.action === "home") {
|
|
568544
|
+
sessionManager.clearCurrentSession();
|
|
568545
|
+
options3.clearSavedMessages();
|
|
568427
568546
|
resetTerminal(stdout);
|
|
568428
568547
|
navigateTo("welcome");
|
|
568429
568548
|
} else if (result2.success && result2.action === "showUsagePanel") {
|
|
@@ -568598,6 +568717,8 @@ Output: ${combinedOutput}`;
|
|
|
568598
568717
|
options3.setMessages((prev) => [...prev, errorMessage]);
|
|
568599
568718
|
}
|
|
568600
568719
|
} else if (result2.success && result2.action === "home") {
|
|
568720
|
+
sessionManager.clearCurrentSession();
|
|
568721
|
+
options3.clearSavedMessages();
|
|
568601
568722
|
resetTerminal(stdout);
|
|
568602
568723
|
navigateTo("welcome");
|
|
568603
568724
|
} else if (result2.success && result2.action === "toggleYolo") {
|
package/bundle/package.json
CHANGED