diff --git a/backend/open_webui/routers/prompts.py b/backend/open_webui/routers/prompts.py index f027dc48c6..35ef52ecc0 100644 --- a/backend/open_webui/routers/prompts.py +++ b/backend/open_webui/routers/prompts.py @@ -188,50 +188,6 @@ async def create_new_prompt( ) -############################ -# GetPromptByCommand -############################ - - -@router.get('/command/{command}', response_model=PromptAccessResponse | None) -async def get_prompt_by_command( - command: str, user=Depends(get_verified_user), db: AsyncSession = Depends(get_async_session) -): - prompt = await Prompts.get_prompt_by_command(command, db=db) - - if prompt: - if ( - user.role == 'admin' - or prompt.user_id == user.id - or await AccessGrants.has_access( - user_id=user.id, - resource_type='prompt', - resource_id=prompt.id, - permission='read', - db=db, - ) - ): - return PromptAccessResponse( - **prompt.model_dump(), - write_access=( - (user.role == 'admin' and BYPASS_ADMIN_ACCESS_CONTROL) - or user.id == prompt.user_id - or await AccessGrants.has_access( - user_id=user.id, - resource_type='prompt', - resource_id=prompt.id, - permission='write', - db=db, - ) - ), - ) - - raise HTTPException( - status_code=status.HTTP_404_NOT_FOUND, - detail=ERROR_MESSAGES.NOT_FOUND, - ) - - ############################ # GetPromptById ############################ diff --git a/src/lib/apis/prompts/index.ts b/src/lib/apis/prompts/index.ts index bdcb1fef54..5a966332a1 100644 --- a/src/lib/apis/prompts/index.ts +++ b/src/lib/apis/prompts/index.ts @@ -226,40 +226,6 @@ export const getPromptList = async (token: string = '') => { return res; }; -export const getPromptByCommand = async (token: string, command: string) => { - let error = null; - - command = command.charAt(0) === '/' ? command.slice(1) : command; - - const res = await fetch(`${WEBUI_API_BASE_URL}/prompts/command/${command}`, { - method: 'GET', - headers: { - Accept: 'application/json', - 'Content-Type': 'application/json', - authorization: `Bearer ${token}` - } - }) - .then(async (res) => { - if (!res.ok) throw await res.json(); - return res.json(); - }) - .then((json) => { - return json; - }) - .catch((err) => { - error = err.detail; - - console.error(err); - return null; - }); - - if (error) { - throw error; - } - - return res; -}; - export const getPromptById = async (token: string, promptId: string) => { let error = null;