Skip to content

prompts

Classes

PromptModel

Bases: BaseModel

Represents a prompt command.

Attributes

command
command: str

The command trigger (e.g., '/help'). Must start with a slash.

user_id
user_id: str

The ID of the user who created the prompt.

title
title: str

The title of the prompt.

content
content: str

The content of the prompt.

timestamp
timestamp: int

Timestamp when the prompt was last updated (epoch time).

access_control
access_control: Optional[dict] = None

Access control settings for prompt visibility and modification permissions.

Dict Fields
  • read (dict, optional): Read access permissions
    • group_ids (list[str], optional): List of group IDs with read access
    • user_ids (list[str], optional): List of user IDs with read access
  • write (dict, optional): Write access permissions
    • group_ids (list[str], optional): List of group IDs with write access
    • user_ids (list[str], optional): List of user IDs with write access

Access control behavior: - None: Public access, available to all users with the "user" role. - {}: Private access, restricted exclusively to the owner. - Custom permissions: Specific access control for reading and writing. Can specify group or user-level restrictions:

{
   "read": {
       "group_ids": ["group_id1", "group_id2"],
       "user_ids":  ["user_id1", "user_id2"]
   },
   "write": {
       "group_ids": ["group_id1", "group_id2"],
       "user_ids":  ["user_id1", "user_id2"]
   }
}

Implementation details: - Used in backend access control checks via has_access() utility function - Frontend components use this structure for access control UI - Admin users bypass access control when BYPASS_ADMIN_ACCESS_CONTROL is enabled - Access control is enforced in all prompt-related endpoints (create, read, update, delete) - Empty lists in group_ids or user_ids are treated as no additional permissions

PromptUserResponse

Bases: PromptModel

Response model for a prompt including user details.

Attributes

user
user: Optional[UserResponse] = None

Details of the user who created the prompt.

PromptForm

Bases: BaseModel

Form for creating or updating a prompt.

Attributes

command
command: str

The command trigger. Must start with a slash (e.g., '/help').

title
title: str

The title of the prompt.

content
content: str

The content of the prompt.

access_control
access_control: Optional[dict] = None

Access control settings for prompt visibility and modification permissions.

Dict Fields
  • read (dict, optional): Read access permissions
    • group_ids (list[str], optional): List of group IDs with read access
    • user_ids (list[str], optional): List of user IDs with read access
  • write (dict, optional): Write access permissions
    • group_ids (list[str], optional): List of group IDs with write access
    • user_ids (list[str], optional): List of user IDs with write access

Access control behavior: - None: Public access, available to all users with the "user" role. - {}: Private access, restricted exclusively to the owner. - Custom permissions: Specific access control for reading and writing. Can specify group or user-level restrictions:

{
   "read": {
       "group_ids": ["group_id1", "group_id2"],
       "user_ids":  ["user_id1", "user_id2"]
   },
   "write": {
       "group_ids": ["group_id1", "group_id2"],
       "user_ids":  ["user_id1", "user_id2"]
   }
}

Implementation details: - Used in backend access control checks via has_access() utility function - Frontend components use this structure for access control UI - Admin users bypass access control when BYPASS_ADMIN_ACCESS_CONTROL is enabled - Access control is enforced in all prompt-related endpoints (create, read, update, delete) - Empty lists in group_ids or user_ids are treated as no additional permissions