Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4c33f210da |
@@ -16,6 +16,7 @@ import type {
|
|||||||
MemoryV2RuntimeStatusResponse,
|
MemoryV2RuntimeStatusResponse,
|
||||||
PersonalMemoryCandidateListResponse,
|
PersonalMemoryCandidateListResponse,
|
||||||
} from '../../types';
|
} from '../../types';
|
||||||
|
import { isMemoryV2SectionEnabled } from './memory-v2-config';
|
||||||
|
|
||||||
type BackendKey =
|
type BackendKey =
|
||||||
| 'pgvector'
|
| 'pgvector'
|
||||||
@@ -923,7 +924,8 @@ export function MemoryV2Page() {
|
|||||||
{CAPABILITIES.map((capability, index) => {
|
{CAPABILITIES.map((capability, index) => {
|
||||||
const section = draft[capability.key];
|
const section = draft[capability.key];
|
||||||
const currentSection = current[capability.key];
|
const currentSection = current[capability.key];
|
||||||
const enabled = Boolean(section.enabled);
|
const enabled = isMemoryV2SectionEnabled(capability.key, section);
|
||||||
|
const savedEnabled = isMemoryV2SectionEnabled(capability.key, currentSection);
|
||||||
const accent = BACKEND_ACCENTS[index % BACKEND_ACCENTS.length];
|
const accent = BACKEND_ACCENTS[index % BACKEND_ACCENTS.length];
|
||||||
return (
|
return (
|
||||||
<section
|
<section
|
||||||
@@ -1015,8 +1017,8 @@ export function MemoryV2Page() {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<span className={`asset-status ${Boolean(currentSection.enabled) ? 'is-on' : ''}`}>
|
<span className={`asset-status ${savedEnabled ? 'is-on' : ''}`}>
|
||||||
当前保存:{Boolean(currentSection.enabled) ? '启用' : '关闭'}
|
当前保存:{savedEnabled ? '启用' : '关闭'}
|
||||||
</span>
|
</span>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import type { MemoryV2AdminSection } from '../../types';
|
||||||
|
|
||||||
|
type CapabilityKey =
|
||||||
|
| 'candidateMemory'
|
||||||
|
| 'runtimeControl'
|
||||||
|
| 'policy'
|
||||||
|
| 'retriever'
|
||||||
|
| 'lifecycle'
|
||||||
|
| 'persona'
|
||||||
|
| 'graph'
|
||||||
|
| 'userMemory'
|
||||||
|
| 'pluginHealth';
|
||||||
|
|
||||||
|
function modeEnabled(value: unknown) {
|
||||||
|
const mode = String(value ?? 'off').trim().toLowerCase();
|
||||||
|
return mode !== '' && mode !== 'off';
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isMemoryV2SectionEnabled(
|
||||||
|
sectionKey: CapabilityKey,
|
||||||
|
section: MemoryV2AdminSection | undefined,
|
||||||
|
): boolean {
|
||||||
|
const config = section ?? {};
|
||||||
|
if (sectionKey === 'runtimeControl') {
|
||||||
|
return Boolean(config.agentResolveEnabled)
|
||||||
|
|| modeEnabled(config.agentInjectionMode)
|
||||||
|
|| Boolean(config.promotionEnabled)
|
||||||
|
|| Boolean(config.compactionV2Enabled)
|
||||||
|
|| Boolean(config.reflectionEnabled)
|
||||||
|
|| Boolean(config.lifecycleWorkerEnabled)
|
||||||
|
|| modeEnabled(config.lifecycleRolloutMode);
|
||||||
|
}
|
||||||
|
return Boolean(config.enabled);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user