mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 13:47:19 +08:00
fix: fix delete messages endpoint url (#1140)
Co-authored-by: Robert Brennan <accounts@rbren.io>
This commit is contained in:
@@ -4,9 +4,9 @@ from pathlib import Path
|
||||
import litellm
|
||||
from fastapi import Depends, FastAPI, WebSocket, Response
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.responses import RedirectResponse
|
||||
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from fastapi.responses import RedirectResponse
|
||||
from starlette import status
|
||||
from starlette.responses import JSONResponse
|
||||
|
||||
@@ -62,7 +62,7 @@ async def get_litellm_agents():
|
||||
|
||||
@app.get('/api/auth')
|
||||
async def get_token(
|
||||
credentials: HTTPAuthorizationCredentials = Depends(security_scheme),
|
||||
credentials: HTTPAuthorizationCredentials = Depends(security_scheme),
|
||||
):
|
||||
"""
|
||||
Get token for authentication when starts a websocket connection.
|
||||
@@ -77,7 +77,7 @@ async def get_token(
|
||||
|
||||
@app.get('/api/messages')
|
||||
async def get_messages(
|
||||
credentials: HTTPAuthorizationCredentials = Depends(security_scheme),
|
||||
credentials: HTTPAuthorizationCredentials = Depends(security_scheme),
|
||||
):
|
||||
data = []
|
||||
sid = get_sid_from_token(credentials.credentials)
|
||||
@@ -92,7 +92,7 @@ async def get_messages(
|
||||
|
||||
@app.get('/api/messages/total')
|
||||
async def get_message_total(
|
||||
credentials: HTTPAuthorizationCredentials = Depends(security_scheme),
|
||||
credentials: HTTPAuthorizationCredentials = Depends(security_scheme),
|
||||
):
|
||||
sid = get_sid_from_token(credentials.credentials)
|
||||
return JSONResponse(
|
||||
@@ -101,9 +101,9 @@ async def get_message_total(
|
||||
)
|
||||
|
||||
|
||||
@app.delete('/messages')
|
||||
@app.delete('/api/messages')
|
||||
async def del_messages(
|
||||
credentials: HTTPAuthorizationCredentials = Depends(security_scheme),
|
||||
credentials: HTTPAuthorizationCredentials = Depends(security_scheme),
|
||||
):
|
||||
sid = get_sid_from_token(credentials.credentials)
|
||||
message_stack.del_messages(sid)
|
||||
@@ -120,8 +120,7 @@ def read_default_model():
|
||||
|
||||
@app.get('/api/refresh-files')
|
||||
def refresh_files():
|
||||
structure = files.get_folder_structure(
|
||||
Path(str(config.get('WORKSPACE_BASE'))))
|
||||
structure = files.get_folder_structure(Path(str(config.get('WORKSPACE_BASE'))))
|
||||
return structure.to_dict()
|
||||
|
||||
|
||||
@@ -144,4 +143,5 @@ async def docs_redirect():
|
||||
response = RedirectResponse(url='/index.html')
|
||||
return response
|
||||
|
||||
|
||||
app.mount('/', StaticFiles(directory='./frontend/dist'), name='dist')
|
||||
|
||||
Reference in New Issue
Block a user