Skip to content

Commit

Permalink
fix(platform): Remove settings endpoint (#8715)
Browse files Browse the repository at this point in the history
remove settings endpoint
  • Loading branch information
aarushik93 authored Nov 19, 2024
1 parent 274419d commit a5734a5
Showing 1 changed file with 2 additions and 45 deletions.
47 changes: 2 additions & 45 deletions autogpt_platform/backend/backend/server/routers/v1.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import asyncio
import logging
from collections import defaultdict
from typing import Annotated, Any, Dict, List
from typing import Annotated, Any, List

import pydantic
from autogpt_libs.auth.middleware import auth_middleware
from autogpt_libs.utils.cache import thread_cached
from fastapi import APIRouter, Body, Depends, HTTPException
from fastapi import APIRouter, Depends, HTTPException
from typing_extensions import Optional, TypedDict

import backend.data.block
Expand Down Expand Up @@ -504,49 +504,6 @@ async def get_execution_schedules(
)


########################################################
##################### Settings ########################
########################################################


@v1_router.post(
path="/settings", tags=["settings"], dependencies=[Depends(auth_middleware)]
)
async def update_configuration(
updated_settings: Annotated[
Dict[str, Any],
Body(
examples=[
{
"config": {
"num_graph_workers": 10,
"num_node_workers": 10,
}
}
]
),
],
):
settings = Settings()
try:
updated_fields: dict[Any, Any] = {"config": [], "secrets": []}
for key, value in updated_settings.get("config", {}).items():
if hasattr(settings.config, key):
setattr(settings.config, key, value)
updated_fields["config"].append(key)
for key, value in updated_settings.get("secrets", {}).items():
if hasattr(settings.secrets, key):
setattr(settings.secrets, key, value)
updated_fields["secrets"].append(key)
settings.save()
return {
"message": "Settings updated successfully",
"updated_fields": updated_fields,
}
except Exception as e:
raise HTTPException(status_code=400, detail=str(e))


########################################################
##################### API KEY ##############################
########################################################
Expand Down

0 comments on commit a5734a5

Please sign in to comment.