Files
colcaroliandClaude Opus 5 0e58a07af4 Pin notes to a chat, and import notes from files
Two additions to the shared notes, both about getting content in and out of
the prompt.

Per-chat pinning. Notes normally reach the model as a title list only, and
the body arrives just if the model decides to call read_note. A 📌 on the tab
now puts a page's full body in the system prompt for the chat that is open,
every turn, no tool round trip. The selection is per session (new table
session_note_pages, unique on session_id + page_id), so different
conversations carry different pages. The title list marks pinned pages so the
model does not read them twice, and bodies are capped per page by
SESSION_NOTES_CONTENT_LIMIT.

A new chat has no session row until its first message, so the front end
cannot PUT the selection yet. POST /chat/stream therefore accepts
note_page_ids and applies it before building the context, which makes the
pins count from the very first turn.

File import. Dropping .md/.txt on the editor - or picking them with the new
⬆ button - creates pages, and a .zip is unpacked into one page per text
entry with the first path component as the section. That is exactly the
shape the export writes, so a downloaded zip round-trips back in. Titles that
collide get a " (2)" suffix rather than overwriting, since restoring a backup
into a live workspace should not destroy anything. UploadFile needs
python-multipart, added to the lockfile.

Toasts grew a kind: the import success message was rendering in the red error
toast, as was the existing session-import message. Both are green now.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-23 16:04:41 +09:00

58 lines
1.0 KiB
TOML

[project]
name = "playchat-backend"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = [
"fastapi>=0.111.0",
"uvicorn>=0.30.0",
"litellm>=1.40.0",
"sqlalchemy>=2.0.0",
"alembic>=1.13.0",
"python-dotenv>=1.0.0",
"sse-starlette>=2.1.0",
"huggingface-hub>=1.17.0",
"psutil>=7.2.2",
"nvidia-ml-py>=13.610.43",
"boto3>=1.43.32",
"apscheduler>=3.11.2",
"httpx>=0.28.1",
"discord-py>=2.7.1",
"janome>=0.5.0",
"trafilatura>=2.1.0",
"python-multipart>=0.0.9",
]
[project.optional-dependencies]
dev = [
"pytest>=8.0.0",
"pytest-asyncio>=0.23.0",
"httpx>=0.27.0",
]
[tool.hatch.build.targets.wheel]
packages = ["app"]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[dependency-groups]
dev = [
"pyright>=1.1.410",
"ruff>=0.15.18",
]
[tool.ruff]
line-length = 119
target-version = "py312"
[tool.ruff.lint]
select = ["E", "F", "I", "UP", "B"]
[tool.pyright]
include = ["app"]
venvPath = "."
venv = ".venv"
typeCheckingMode = "basic"
pythonVersion = "3.12"