发布 v1.10 #5
@@ -45,7 +45,6 @@ import AgentCommandBar from './components/AgentCommandBar.vue';
|
|||||||
import AgentInspectorPanel from './components/AgentInspectorPanel.vue';
|
import AgentInspectorPanel from './components/AgentInspectorPanel.vue';
|
||||||
import AgentSkillSelectorDialog from './components/AgentSkillSelectorDialog.vue';
|
import AgentSkillSelectorDialog from './components/AgentSkillSelectorDialog.vue';
|
||||||
import { useAgentDesignerState } from './composables/useAgentDesignerState';
|
import { useAgentDesignerState } from './composables/useAgentDesignerState';
|
||||||
import { resolveAgentCompressionTokenThreshold } from './compression-threshold';
|
|
||||||
import { createMcpToolLoader } from './mcpToolLoader';
|
import { createMcpToolLoader } from './mcpToolLoader';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
@@ -423,25 +422,8 @@ function runValidation() {
|
|||||||
return true;
|
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) {
|
async function handleSave(showMessage = true) {
|
||||||
if (!runValidation()) return false;
|
if (!runValidation()) return false;
|
||||||
syncAgentCompressionThreshold();
|
|
||||||
saveLoading.value = true;
|
saveLoading.value = true;
|
||||||
try {
|
try {
|
||||||
const agentPayload = buildPayloadAgent({
|
const agentPayload = buildPayloadAgent({
|
||||||
@@ -556,7 +538,6 @@ async function handleOffline() {
|
|||||||
|
|
||||||
function handleTryout() {
|
function handleTryout() {
|
||||||
if (!runValidation()) return;
|
if (!runValidation()) return;
|
||||||
syncAgentCompressionThreshold();
|
|
||||||
openTryout();
|
openTryout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ describe('useAgentDesignerState document context budget', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('useAgentDesignerState memory compression', () => {
|
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(
|
expect(
|
||||||
createEmptyAgent().memoryConfigJson?.compressionParameter,
|
createEmptyAgent().memoryConfigJson?.compressionParameter,
|
||||||
).not.toHaveProperty('msgThreshold');
|
).not.toHaveProperty('msgThreshold');
|
||||||
@@ -98,7 +98,7 @@ describe('useAgentDesignerState memory compression', () => {
|
|||||||
enabled: true,
|
enabled: true,
|
||||||
msgThreshold: 12,
|
msgThreshold: 12,
|
||||||
lastKeep: 6,
|
lastKeep: 6,
|
||||||
minCompressionTokenThreshold: 128_000,
|
minCompressionTokenThreshold: 800_000,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -108,7 +108,7 @@ describe('useAgentDesignerState memory compression', () => {
|
|||||||
expect(stateCompressionParameter).not.toHaveProperty('msgThreshold');
|
expect(stateCompressionParameter).not.toHaveProperty('msgThreshold');
|
||||||
expect(stateCompressionParameter?.lastKeep).toBe(6);
|
expect(stateCompressionParameter?.lastKeep).toBe(6);
|
||||||
expect(stateCompressionParameter?.minCompressionTokenThreshold).toBe(
|
expect(stateCompressionParameter?.minCompressionTokenThreshold).toBe(
|
||||||
128_000,
|
800_000,
|
||||||
);
|
);
|
||||||
|
|
||||||
const payloadMemoryConfig = designer.buildPayloadAgent().memoryConfigJson;
|
const payloadMemoryConfig = designer.buildPayloadAgent().memoryConfigJson;
|
||||||
@@ -118,7 +118,7 @@ describe('useAgentDesignerState memory compression', () => {
|
|||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
payloadMemoryConfig?.compressionParameter.minCompressionTokenThreshold,
|
payloadMemoryConfig?.compressionParameter.minCompressionTokenThreshold,
|
||||||
).toBe(128_000);
|
).toBe(800_000);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user