- URL 하드코딩 → .env APP_URL 기반 동적 URL로 변경 - DB 연결 하드코딩 → .env 기반으로 변경 - MySQL strict mode DATE 오류 수정
41 lines
1.7 KiB
Markdown
41 lines
1.7 KiB
Markdown
# Implementation Plan - Advanced Vector RAG (Parallel Deployment)
|
|
|
|
We will build the "Advanced Vector RAG" system as a separate module to compare with the existing "Live Search RAG".
|
|
|
|
## User Review Required
|
|
> [!NOTE]
|
|
> **New Menu Item**: "운영자 vertex RAG 챗봇" will be added to the SAM menu.
|
|
> **Initial Setup**: You must run `chatbot/rag/ingest.php` once to populate the vector database.
|
|
|
|
## Proposed Changes
|
|
|
|
### 1. New UI & Entry Point
|
|
#### [MODIFY] [myheader.php](file:///c:/Project/5130/myheader.php)
|
|
- Add new menu item: "운영자 vertex RAG 챗봇" linking to `chatbot/rag_index.php`.
|
|
|
|
#### [NEW] [chatbot/rag_index.php](file:///c:/Project/5130/chatbot/rag_index.php)
|
|
- Copied from `index.php`.
|
|
- Updated to call `rag_api.php` instead of `api.php`.
|
|
- Updated title/branding to indicate "RAG Version".
|
|
|
|
### 2. Vector Backend
|
|
#### [NEW] [chatbot/rag_api.php](file:///c:/Project/5130/chatbot/rag_api.php)
|
|
- Copied from `api.php`.
|
|
- logic: `NotionClient->search()` replaced with `VectorSearch->search()`.
|
|
|
|
### 3. Vector Engine (Core Logic)
|
|
#### [NEW] [chatbot/rag/ingest.php](file:///c:/Project/5130/chatbot/rag/ingest.php)
|
|
- EXTRACT: Fetch all Notion pages.
|
|
- EMBED: Generate vectors using Gemini `text-embedding-004`.
|
|
- STORE: Save to `chatbot/rag/data/vectors.json`.
|
|
|
|
#### [NEW] [chatbot/rag/search.php](file:///c:/Project/5130/chatbot/rag/search.php)
|
|
- LOAD: Read `vectors.json`.
|
|
- SEARCH: Calculate Cosine Similarity between Query Vector and Stored Vectors.
|
|
- RETRIEVE: Return top 5 matches.
|
|
|
|
## Verification Plan
|
|
1. **Menu Check**: Verify new menu item appears and leads to the new page.
|
|
2. **Ingestion**: Run `ingest.php` (via browser or CLI) and check `vectors.json` size.
|
|
3. **Comparison Test**: Ask the same question to both chatbots and compare answers.
|