mirror of
https://github.com/furyhawk/agent_delta.git
synced 2026-07-21 02:05:36 +00:00
refactor: update UserSlashCommand relationship and improve healthcheck command in docker-compose
This commit is contained in:
@@ -10,15 +10,12 @@ The unique ``(user_id, name)`` constraint prevents a user from shadowing a
|
|||||||
built-in's name with a custom command of the same name.
|
built-in's name with a custom command of the same name.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import uuid
|
import uuid
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from sqlalchemy import Boolean, Column, ForeignKey, Text, UniqueConstraint
|
from sqlalchemy import Boolean, Column, ForeignKey, Text, UniqueConstraint
|
||||||
from sqlalchemy.dialects.postgresql import UUID as PG_UUID
|
from sqlalchemy.dialects.postgresql import UUID as PG_UUID
|
||||||
from sqlalchemy.orm import relationship
|
from sqlmodel import Field, Relationship, SQLModel
|
||||||
from sqlmodel import Field, SQLModel
|
|
||||||
|
|
||||||
from app.db.base import TimestampMixin
|
from app.db.base import TimestampMixin
|
||||||
|
|
||||||
@@ -48,7 +45,7 @@ class UserSlashCommand(TimestampMixin, SQLModel, table=True):
|
|||||||
prompt: str | None = Field(default=None, sa_column=Column(Text, nullable=True))
|
prompt: str | None = Field(default=None, sa_column=Column(Text, nullable=True))
|
||||||
is_enabled: bool = Field(default=True, sa_column=Column(Boolean, nullable=False, default=True))
|
is_enabled: bool = Field(default=True, sa_column=Column(Boolean, nullable=False, default=True))
|
||||||
|
|
||||||
user: User = relationship("User", lazy="joined")
|
user: "User" = Relationship(sa_relationship_kwargs={"lazy": "joined"})
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
kind = "custom" if self.prompt is not None else "builtin-override"
|
kind = "custom" if self.prompt is not None else "builtin-override"
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- backend
|
- backend
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:6333/healthz"]
|
test: bash -c ':> /dev/tcp/127.0.0.1/6333' || exit 1
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
|
|||||||
Reference in New Issue
Block a user