mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
refactor: multi-provider memory adapters with scan-based builtin (#227)
* refactor: restructure memory into multi-provider adapters, remove manifest.json dependency - Rename internal/memory/provider to internal/memory/adapters with per-provider subdirectories (builtin, mem0, openviking) - Replace manifest.json-based delete/update with scan-based index from daily files - Add mem0 and openviking provider adapters with HTTP client, chat hooks, MCP tools, and CRUD - Wire provider lifecycle into registry (auto-instantiate on create, evict on update/delete) - Split docker-compose into base stack + optional overlays (qdrant, browser, mem0, openviking) - Update admin UI to support dynamic provider config schema rendering * chore(lint): fix all golangci-lint issues for clean CI * refactor(docker): replace compose overlay files with profiles * feat(memory): add built-in memory multi modes * fix(ci): golangci lint * feat(memory): edit built-in memory sparse design
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
# Sparse encoding service — runs the OpenSearch neural sparse model
|
||||
# as a standalone HTTP service (Flask + PyTorch CPU).
|
||||
# Used by the Go server's sparse memory runtime via HTTP.
|
||||
|
||||
FROM python:3.12-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY internal/memory/sparse/service/requirements.txt requirements.txt
|
||||
RUN pip install --no-cache-dir \
|
||||
--extra-index-url https://download.pytorch.org/whl/cpu \
|
||||
-r requirements.txt
|
||||
|
||||
COPY internal/memory/sparse/service/main.py main.py
|
||||
|
||||
ENV SPARSE_PORT=8085
|
||||
ENV SPARSE_CACHE_DIR=/opt/sparse-cache
|
||||
|
||||
RUN mkdir -p /opt/sparse-cache
|
||||
|
||||
# Pre-download the default sparse model during image build so containers
|
||||
# start with a warm cache and do not need to fetch weights on first boot.
|
||||
RUN python - <<'PY'
|
||||
from pathlib import Path
|
||||
from huggingface_hub import hf_hub_download
|
||||
from transformers import AutoModelForMaskedLM, AutoTokenizer
|
||||
|
||||
model_repo = "opensearch-project/opensearch-neural-sparse-encoding-multilingual-v1"
|
||||
cache_dir = "/opt/sparse-cache"
|
||||
Path(cache_dir).mkdir(parents=True, exist_ok=True)
|
||||
|
||||
AutoModelForMaskedLM.from_pretrained(model_repo, cache_dir=cache_dir)
|
||||
AutoTokenizer.from_pretrained(model_repo, cache_dir=cache_dir)
|
||||
hf_hub_download(repo_id=model_repo, filename="idf.json", cache_dir=cache_dir)
|
||||
|
||||
print(f"Pre-downloaded sparse model: {model_repo}")
|
||||
PY
|
||||
|
||||
EXPOSE 8085
|
||||
|
||||
CMD ["python", "main.py"]
|
||||
@@ -31,6 +31,11 @@ services:
|
||||
- VITE_API_URL=${VITE_API_URL:-/api}
|
||||
- VITE_AGENT_URL=${VITE_AGENT_URL:-/agent}
|
||||
|
||||
sparse:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/Dockerfile.sparse
|
||||
|
||||
browser:
|
||||
build:
|
||||
context: .
|
||||
|
||||
Reference in New Issue
Block a user