@yeaft/webchat-agent 0.1.101 → 0.1.102
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/claude.js +1 -1
- package/conversation.js +1 -1
- package/crew/routing.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
package/claude.js
CHANGED
|
@@ -516,7 +516,7 @@ async function processClaudeOutput(conversationId, claudeQuery, state) {
|
|
|
516
516
|
console.log(`[RolePlay] Auto-continuing to role: ${to}`);
|
|
517
517
|
|
|
518
518
|
// ★ Pre-send compact check for RolePlay auto-continue
|
|
519
|
-
const rpAutoCompactThreshold = ctx.CONFIG?.autoCompactThreshold ||
|
|
519
|
+
const rpAutoCompactThreshold = ctx.CONFIG?.autoCompactThreshold || 100000;
|
|
520
520
|
const rpEstimatedNewTokens = Math.ceil(prompt.length / 3);
|
|
521
521
|
// Include output_tokens: the assistant's output becomes part of context for the next turn
|
|
522
522
|
const rpOutputTokens = message.usage?.output_tokens || 0;
|
package/conversation.js
CHANGED
|
@@ -673,7 +673,7 @@ export async function handleUserInput(msg) {
|
|
|
673
673
|
console.log(`[${conversationId}] Sending: ${prompt.substring(0, 100)}...`);
|
|
674
674
|
|
|
675
675
|
// ★ Pre-send compact check: estimate total tokens and compact before sending if needed
|
|
676
|
-
const autoCompactThreshold = ctx.CONFIG?.autoCompactThreshold ||
|
|
676
|
+
const autoCompactThreshold = ctx.CONFIG?.autoCompactThreshold || 100000;
|
|
677
677
|
const lastInputTokens = state.lastResultInputTokens || 0;
|
|
678
678
|
const lastOutputTokens = state.lastResultOutputTokens || 0;
|
|
679
679
|
const estimatedNewTokens = Math.ceil(effectivePrompt.length / 3); // conservative: ~3 chars per token
|
package/crew/routing.js
CHANGED
|
@@ -195,7 +195,7 @@ export async function dispatchToRole(session, roleName, content, fromSource, tas
|
|
|
195
195
|
});
|
|
196
196
|
|
|
197
197
|
// ★ Pre-send compact check: estimate total tokens and clear+rebuild if needed
|
|
198
|
-
const autoCompactThreshold = ctx.CONFIG?.autoCompactThreshold ||
|
|
198
|
+
const autoCompactThreshold = ctx.CONFIG?.autoCompactThreshold || 100000;
|
|
199
199
|
const lastInputTokens = roleState.lastInputTokens || 0;
|
|
200
200
|
const estimatedNewTokens = Math.ceil((typeof content === 'string' ? content.length : 0) / 3);
|
|
201
201
|
const estimatedTotal = lastInputTokens + estimatedNewTokens;
|
package/index.js
CHANGED
|
@@ -78,7 +78,7 @@ const CONFIG = {
|
|
|
78
78
|
// 最大上下文 tokens(用于百分比计算的分母)
|
|
79
79
|
maxContextTokens: parseInt(process.env.MAX_CONTEXT_TOKENS || fileConfig.maxContextTokens, 10) || 128000,
|
|
80
80
|
// Auto-compact 阈值(tokens):context 超过此值时自动触发 compact
|
|
81
|
-
autoCompactThreshold: parseInt(process.env.AUTO_COMPACT_THRESHOLD || fileConfig.autoCompactThreshold, 10) ||
|
|
81
|
+
autoCompactThreshold: parseInt(process.env.AUTO_COMPACT_THRESHOLD || fileConfig.autoCompactThreshold, 10) || 100000
|
|
82
82
|
};
|
|
83
83
|
|
|
84
84
|
// 初始化共享上下文
|