|
@@ -89,6 +89,7 @@ from open_webui.internal.db import Session, engine
|
|
from open_webui.models.functions import Functions
|
|
from open_webui.models.functions import Functions
|
|
from open_webui.models.models import Models
|
|
from open_webui.models.models import Models
|
|
from open_webui.models.users import UserModel, Users
|
|
from open_webui.models.users import UserModel, Users
|
|
|
|
+from open_webui.models.chats import Chats
|
|
|
|
|
|
from open_webui.config import (
|
|
from open_webui.config import (
|
|
LICENSE_KEY,
|
|
LICENSE_KEY,
|
|
@@ -428,7 +429,10 @@ app = FastAPI(
|
|
|
|
|
|
oauth_manager = OAuthManager(app)
|
|
oauth_manager = OAuthManager(app)
|
|
|
|
|
|
-app.state.config = AppConfig(redis_url=REDIS_URL, redis_sentinels=get_sentinels_from_env(REDIS_SENTINEL_HOSTS, REDIS_SENTINEL_PORT))
|
|
|
|
|
|
+app.state.config = AppConfig(
|
|
|
|
+ redis_url=REDIS_URL,
|
|
|
|
+ redis_sentinels=get_sentinels_from_env(REDIS_SENTINEL_HOSTS, REDIS_SENTINEL_PORT),
|
|
|
|
+)
|
|
|
|
|
|
app.state.WEBUI_NAME = WEBUI_NAME
|
|
app.state.WEBUI_NAME = WEBUI_NAME
|
|
app.state.LICENSE_METADATA = None
|
|
app.state.LICENSE_METADATA = None
|
|
@@ -1084,6 +1088,14 @@ async def chat_completion(
|
|
|
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
log.debug(f"Error processing chat payload: {e}")
|
|
log.debug(f"Error processing chat payload: {e}")
|
|
|
|
+ Chats.upsert_message_to_chat_by_id_and_message_id(
|
|
|
|
+ metadata["chat_id"],
|
|
|
|
+ metadata["message_id"],
|
|
|
|
+ {
|
|
|
|
+ "error": {"content": str(e)},
|
|
|
|
+ },
|
|
|
|
+ )
|
|
|
|
+
|
|
raise HTTPException(
|
|
raise HTTPException(
|
|
status_code=status.HTTP_400_BAD_REQUEST,
|
|
status_code=status.HTTP_400_BAD_REQUEST,
|
|
detail=str(e),
|
|
detail=str(e),
|