-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Description Prompt module with Service ## Checklist before requesting a review Please delete options that are not relevant. - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented hard-to-understand areas - [ ] I have ideally added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged ## Screenshots (if appropriate):
- Loading branch information
Showing
27 changed files
with
209 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
from models.databases.supabase.api_brain_definition import ApiBrainDefinitions | ||
from models.databases.supabase.api_key_handler import ApiKeyHandler | ||
from models.databases.supabase.brains import Brain | ||
from models.databases.supabase.brains_subscription_invitations import BrainSubscription | ||
from models.databases.supabase.brains_subscription_invitations import \ | ||
BrainSubscription | ||
from models.databases.supabase.chats import Chats | ||
from models.databases.supabase.files import File | ||
from models.databases.supabase.knowledge import Knowledges | ||
from models.databases.supabase.notifications import Notifications | ||
from models.databases.supabase.onboarding import Onboarding | ||
from models.databases.supabase.prompts import Prompts | ||
from models.databases.supabase.user_usage import UserUsage | ||
from models.databases.supabase.vectors import Vector | ||
|
||
from models.databases.supabase.api_brain_definition import ApiBrainDefinitions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .prompt import Prompt, PromptStatusEnum, CreatePromptProperties, PromptUpdatableProperties, DeletePromptResponse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from enum import Enum | ||
from typing import Optional | ||
from uuid import UUID | ||
|
||
from pydantic import BaseModel | ||
|
||
|
||
class PromptStatusEnum(str, Enum): | ||
private = "private" | ||
public = "public" | ||
|
||
|
||
class Prompt(BaseModel): | ||
title: str | ||
content: str | ||
status: PromptStatusEnum = PromptStatusEnum.private | ||
id: UUID | ||
|
||
|
||
class CreatePromptProperties(BaseModel): | ||
"""Properties that can be received on prompt creation""" | ||
|
||
title: str | ||
content: str | ||
status: PromptStatusEnum = PromptStatusEnum.private | ||
|
||
|
||
class PromptUpdatableProperties(BaseModel): | ||
"""Properties that can be received on prompt update""" | ||
|
||
title: Optional[str] | ||
content: Optional[str] | ||
status: Optional[PromptStatusEnum] | ||
|
||
|
||
class DeletePromptResponse(BaseModel): | ||
"""Response when deleting a prompt""" | ||
|
||
status: str = "delete" | ||
prompt_id: UUID |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
from abc import ABC, abstractmethod | ||
from uuid import UUID | ||
|
||
from modules.prompt.entity import ( | ||
CreatePromptProperties, | ||
DeletePromptResponse, | ||
Prompt, | ||
PromptUpdatableProperties, | ||
) | ||
|
||
|
||
class PromptsInterface(ABC): | ||
@abstractmethod | ||
def create_prompt(self, prompt: CreatePromptProperties) -> Prompt: | ||
""" | ||
Create a prompt | ||
""" | ||
pass | ||
|
||
@abstractmethod | ||
def delete_prompt_by_id(self, prompt_id: UUID) -> DeletePromptResponse: | ||
""" | ||
Delete a prompt by id | ||
Args: | ||
prompt_id (UUID): The id of the prompt | ||
Returns: | ||
A dictionary containing the status of the delete and prompt_id of the deleted prompt | ||
""" | ||
pass | ||
|
||
@abstractmethod | ||
def get_prompt_by_id(self, prompt_id: UUID) -> Prompt | None: | ||
""" | ||
Get a prompt by its id | ||
Args: | ||
prompt_id (UUID): The id of the prompt | ||
Returns: | ||
Prompt: The prompt | ||
""" | ||
pass | ||
|
||
@abstractmethod | ||
def get_public_prompts(self) -> list[Prompt]: | ||
""" | ||
List all public prompts | ||
""" | ||
pass | ||
|
||
@abstractmethod | ||
def update_prompt_by_id( | ||
self, prompt_id: UUID, prompt: PromptUpdatableProperties | ||
) -> Prompt: | ||
"""Update a prompt by id""" | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .prompt_service import PromptService |
Oops, something went wrong.