fix: vision tasks inherit user_id, admin owns mount root

- detect_objects, classify_content, recluster_faces now look up the
  photo's user_id and set it on created Tag rows — fixes tags being
  invisible to the owning user due to NULL user_id
- Initial admin setup creates source root at the mount root (/photos)
  instead of a subdirectory, since the admin owns the entire library
- Revert to OpenCLIP ViT-B/32 (512-d) as default embedder — SigLIP
  requires transformers version alignment not yet available in the
  Docker image. SigLIP2 code remains for future enablement.
- Add transformers to requirements for future SigLIP support

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-13 00:01:28 +02:00
parent 35d87a2749
commit fbeefb24a0
9 changed files with 35 additions and 17 deletions

View File

@@ -161,7 +161,9 @@ async def setup(body: SetupRequest, db: AsyncSession = Depends(get_db)):
if len(body.password) < 6:
raise HTTPException(status_code=400, detail="Password must be at least 6 characters")
media_path = os.path.join(settings.photo_dirs, body.username.strip())
# The initial admin owns the entire photo mount root. Regular users
# (created later via admin panel) get a subdirectory under it.
media_path = settings.photo_dirs
os.makedirs(media_path, exist_ok=True)
user = User(
@@ -171,8 +173,8 @@ async def setup(body: SetupRequest, db: AsyncSession = Depends(get_db)):
media_path=media_path,
)
db.add(user)
await db.flush() # get user.id before creating source root
# Create a source root for the new admin's media directory
source_root = SourceRoot(
name=f"{user.username}'s Library",
path=media_path,