Browse the knowledge base from a single side panel menu

Add a read-only view of backend/knowledge_base/**.md so the files that get
injected into the system prompt can be inspected from the GUI:

- GET /api/kb/files lists the Markdown files (title, preview, size, mtime and
  whether the file is already embedded), GET /api/kb/file returns one in full.
  Paths are resolved against the knowledge base directory and rejected unless
  they stay inside it and end in .md.
- KnowledgeBasePanel.vue groups the files by folder (collapsible, so web_search
  can be folded away), filters by title/path/preview and renders the selected
  file with MarkdownContent.

The header had grown to four side panel toggles, so collapse them into one
menu: panels.ts now holds the list of panels along with the component each one
renders, App.vue picks it with <component :is>, and SidePanelMenu.vue shows the
active panel on its button. Re-picking the open panel (or "パネルを閉じる")
closes it; a click outside or Esc closes just the menu.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-23 21:38:54 +09:00
co-authored by Claude Opus 5
parent 5d63a59b86
commit f085db421c
13 changed files with 654 additions and 34 deletions
+28
View File
@@ -0,0 +1,28 @@
import type { Component } from 'vue'
import KnowledgeBasePanel from './components/KnowledgeBasePanel.vue'
import LogViewer from './components/LogViewer.vue'
import NotePanel from './components/NotePanel.vue'
import SettingsPanel from './components/SettingsPanel.vue'
/** 右サイドに開けるパネル。'none' はどれも開いていない状態。 */
export type PanelId = 'notes' | 'kb' | 'settings' | 'logs'
export interface SidePanelDef {
id: PanelId
label: string
icon: string
/** メニューに添える一行説明 */
description: string
component: Component
}
/**
* 右サイドパネルの一覧。ヘッダーのメニューの並びと、開いたときに描画されるコンポーネントを兼ねる。
* パネルを増やすときはここに1行足すだけでよい。
*/
export const SIDE_PANELS: SidePanelDef[] = [
{ id: 'notes', label: 'ノート', icon: '📝', description: 'AIと共有するノートの編集', component: NotePanel },
{ id: 'kb', label: 'ナレッジベース', icon: '📚', description: 'knowledge_base/ の Markdown を閲覧', component: KnowledgeBasePanel },
{ id: 'settings', label: '設定', icon: '⚙️', description: 'APIキー・モデルプリセット', component: SettingsPanel },
{ id: 'logs', label: 'ログ', icon: '📜', description: 'LLM API 呼び出しの履歴', component: LogViewer },
]