发布 v1.10 #5
@@ -45,7 +45,6 @@ import AgentCommandBar from './components/AgentCommandBar.vue';
|
||||
import AgentInspectorPanel from './components/AgentInspectorPanel.vue';
|
||||
import AgentSkillSelectorDialog from './components/AgentSkillSelectorDialog.vue';
|
||||
import { useAgentDesignerState } from './composables/useAgentDesignerState';
|
||||
import { resolveAgentCompressionTokenThreshold } from './compression-threshold';
|
||||
import { createMcpToolLoader } from './mcpToolLoader';
|
||||
|
||||
const route = useRoute();
|
||||
@@ -423,25 +422,8 @@ function runValidation() {
|
||||
return true;
|
||||
}
|
||||
|
||||
function syncAgentCompressionThreshold() {
|
||||
const selectedModel = models.value.find(
|
||||
(model) => model.value === String(state.agent.modelId ?? ''),
|
||||
);
|
||||
const memoryConfig = (state.agent.memoryConfigJson ||= {});
|
||||
const compressionParameter = (memoryConfig.compressionParameter ||= {});
|
||||
compressionParameter.minCompressionTokenThreshold =
|
||||
resolveAgentCompressionTokenThreshold({
|
||||
contextWindowTokens: selectedModel?.raw?.contextWindowTokens,
|
||||
generationConfig: state.agent.generationConfigJson,
|
||||
maxOutputTokens: selectedModel?.raw?.maxOutputTokens,
|
||||
systemPrompt: state.agent.promptConfigJson?.systemPrompt,
|
||||
toolBindings: state.toolBindings,
|
||||
});
|
||||
}
|
||||
|
||||
async function handleSave(showMessage = true) {
|
||||
if (!runValidation()) return false;
|
||||
syncAgentCompressionThreshold();
|
||||
saveLoading.value = true;
|
||||
try {
|
||||
const agentPayload = buildPayloadAgent({
|
||||
@@ -556,7 +538,6 @@ async function handleOffline() {
|
||||
|
||||
function handleTryout() {
|
||||
if (!runValidation()) return;
|
||||
syncAgentCompressionThreshold();
|
||||
openTryout();
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ describe('useAgentDesignerState document context budget', () => {
|
||||
});
|
||||
|
||||
describe('useAgentDesignerState memory compression', () => {
|
||||
it('keeps only token-based compression settings in state and payload', () => {
|
||||
it('keeps the manually configured token threshold in state and payload', () => {
|
||||
expect(
|
||||
createEmptyAgent().memoryConfigJson?.compressionParameter,
|
||||
).not.toHaveProperty('msgThreshold');
|
||||
@@ -98,7 +98,7 @@ describe('useAgentDesignerState memory compression', () => {
|
||||
enabled: true,
|
||||
msgThreshold: 12,
|
||||
lastKeep: 6,
|
||||
minCompressionTokenThreshold: 128_000,
|
||||
minCompressionTokenThreshold: 800_000,
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -108,7 +108,7 @@ describe('useAgentDesignerState memory compression', () => {
|
||||
expect(stateCompressionParameter).not.toHaveProperty('msgThreshold');
|
||||
expect(stateCompressionParameter?.lastKeep).toBe(6);
|
||||
expect(stateCompressionParameter?.minCompressionTokenThreshold).toBe(
|
||||
128_000,
|
||||
800_000,
|
||||
);
|
||||
|
||||
const payloadMemoryConfig = designer.buildPayloadAgent().memoryConfigJson;
|
||||
@@ -118,7 +118,7 @@ describe('useAgentDesignerState memory compression', () => {
|
||||
);
|
||||
expect(
|
||||
payloadMemoryConfig?.compressionParameter.minCompressionTokenThreshold,
|
||||
).toBe(128_000);
|
||||
).toBe(800_000);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user