Add Docker/Lightsail deployment, web search summarization, and fix vite peer dep
- Add backend/frontend Dockerfiles, nginx reverse proxy config, and docker-compose.yml to run the app on AWS Lightsail; document the setup in docs/deploy-lightsail.md. Fix a .gitignore path anchoring bug that left backend/knowledge_base/web_search/ untracked instead of ignored. - Summarize web search results into structured Markdown via LLM before saving them to the local knowledge base, and support regenerating existing entries from their source URLs (backend/app/core/memory_kb). - Downgrade vite to ^6 to match @vitejs/plugin-vue's peer dependency range, fixing a failing `npm ci` (found while testing the Docker build). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+10
-1
@@ -11,6 +11,7 @@ from app.db.models import Session, Message
|
||||
from app.core.memory_kb import memory as mem
|
||||
from app.core import llm
|
||||
from app.core.memory_kb import knowledge
|
||||
from app.core.memory_kb import local_knowledge
|
||||
from app.core.search.websearch import WEB_SEARCH_TOOL
|
||||
from app.core.config import DEFAULT_MODEL
|
||||
from app.core.memory_kb.tagging import tag_message_by_id
|
||||
@@ -77,6 +78,13 @@ def delete_session(session_id: str, db: DBSession = Depends(get_db)):
|
||||
db.commit()
|
||||
|
||||
|
||||
@router.post("/knowledge/regenerate")
|
||||
async def regenerate_knowledge(db: DBSession = Depends(get_db)):
|
||||
"""既存のKnowledgeEntryを出典URLから取得し直し、構造化要約に再生成する(一括実行用)。"""
|
||||
count = await knowledge.regenerate_from_sources(db)
|
||||
return {"regenerated": count}
|
||||
|
||||
|
||||
@router.post("/stream")
|
||||
async def stream_chat(req: ChatRequest, db: DBSession = Depends(get_db)):
|
||||
# セッション取得 or 新規作成
|
||||
@@ -126,9 +134,10 @@ async def stream_chat(req: ChatRequest, db: DBSession = Depends(get_db)):
|
||||
]
|
||||
yield sse({"type": "sources", "value": sources})
|
||||
for s in searches:
|
||||
summary = "\n".join(r["content"][:300] for r in s["results"] if r["content"])
|
||||
summary = await knowledge.summarize_results(s["query"], s["results"])
|
||||
if summary:
|
||||
knowledge.save_knowledge(db, s["query"], summary, s["results"])
|
||||
local_knowledge.save_search_result(s["query"], summary, s["results"])
|
||||
|
||||
search_tools = [WEB_SEARCH_TOOL] if len(resolved_context) > len(context) else None
|
||||
async for chunk in llm.stream_chat(
|
||||
|
||||
Reference in New Issue
Block a user