diff --git a/frontend/src/components/ContextManager.vue b/frontend/src/components/ContextManager.vue index d8cf894..b8c68ed 100644 --- a/frontend/src/components/ContextManager.vue +++ b/frontend/src/components/ContextManager.vue @@ -107,7 +107,7 @@ const extractMetadata = (content: string) => { // 1. Extract Title (First H1 or first non-empty line) const titleMatch = content.match(/^#\s+(.*)/m) - if (titleMatch) { + if (titleMatch && titleMatch[1]) { title = titleMatch[1].trim() } else { const firstLine = lines.find(l => l.trim().length > 0) @@ -136,12 +136,12 @@ const extractMetadata = (content: string) => { // Look for "Core Logic", "Architecture", "Introduction" headers const logicRegex = /##\s*(Core Logic|Architecture|Introduction|About|Features)([\s\S]*?)(##|$)/i const logicMatch = content.match(logicRegex) - if (logicMatch) { + if (logicMatch && logicMatch[2]) { coreLogic = logicMatch[2].trim().substring(0, 300) + (logicMatch[2].length > 300 ? '...' : '') } else { // Fallback: First paragraph after title const paragraphs = content.split(/\n\s*\n/) - if (paragraphs.length > 1) { + if (paragraphs.length > 1 && paragraphs[1]) { coreLogic = paragraphs[1].trim().substring(0, 200) + '...' } } diff --git a/frontend/src/components/LLMSettings.vue b/frontend/src/components/LLMSettings.vue index 44d71ba..990cb79 100644 --- a/frontend/src/components/LLMSettings.vue +++ b/frontend/src/components/LLMSettings.vue @@ -52,7 +52,7 @@ -