mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
Update memory and context summary UI for multiple context filenames (#1282)
This commit is contained in:
@@ -6,9 +6,11 @@
|
||||
|
||||
import { Message, MessageType } from '../types.js';
|
||||
import { Config } from '@gemini-cli/core';
|
||||
import { LoadedSettings } from '../../config/settings.js';
|
||||
|
||||
export function createShowMemoryAction(
|
||||
config: Config | null,
|
||||
settings: LoadedSettings,
|
||||
addMessage: (message: Message) => void,
|
||||
) {
|
||||
return async () => {
|
||||
@@ -29,18 +31,26 @@ export function createShowMemoryAction(
|
||||
|
||||
const currentMemory = config.getUserMemory();
|
||||
const fileCount = config.getGeminiMdFileCount();
|
||||
const contextFileName = settings.merged.contextFileName;
|
||||
const contextFileNames = Array.isArray(contextFileName)
|
||||
? contextFileName
|
||||
: [contextFileName];
|
||||
|
||||
if (debugMode) {
|
||||
console.log(
|
||||
`[DEBUG] Showing memory. Content from config.getUserMemory() (first 200 chars): ${currentMemory.substring(0, 200)}...`,
|
||||
);
|
||||
console.log(`[DEBUG] Number of GEMINI.md files loaded: ${fileCount}`);
|
||||
console.log(`[DEBUG] Number of context files loaded: ${fileCount}`);
|
||||
}
|
||||
|
||||
if (fileCount > 0) {
|
||||
const allNamesTheSame = new Set(contextFileNames).size < 2;
|
||||
const name = allNamesTheSame ? contextFileNames[0] : 'context';
|
||||
addMessage({
|
||||
type: MessageType.INFO,
|
||||
content: `Loaded memory from ${fileCount} GEMINI.md file(s).`,
|
||||
content: `Loaded memory from ${fileCount} ${name} file${
|
||||
fileCount > 1 ? 's' : ''
|
||||
}.`,
|
||||
timestamp: new Date(),
|
||||
});
|
||||
}
|
||||
@@ -48,7 +58,7 @@ export function createShowMemoryAction(
|
||||
if (currentMemory && currentMemory.trim().length > 0) {
|
||||
addMessage({
|
||||
type: MessageType.INFO,
|
||||
content: `Current combined GEMINI.md memory content:\n\`\`\`markdown\n${currentMemory}\n\`\`\``,
|
||||
content: `Current combined memory content:\n\`\`\`markdown\n${currentMemory}\n\`\`\``,
|
||||
timestamp: new Date(),
|
||||
});
|
||||
} else {
|
||||
@@ -56,8 +66,8 @@ export function createShowMemoryAction(
|
||||
type: MessageType.INFO,
|
||||
content:
|
||||
fileCount > 0
|
||||
? 'Hierarchical memory (GEMINI.md) is loaded but content is empty.'
|
||||
: 'No hierarchical memory (GEMINI.md) is currently loaded.',
|
||||
? 'Hierarchical memory (GEMINI.md or other context files) is loaded but content is empty.'
|
||||
: 'No hierarchical memory (GEMINI.md or other context files) is currently loaded.',
|
||||
timestamp: new Date(),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user