mirror of
https://github.com/open-webui/open-webui
synced 2025-02-16 18:22:29 +00:00
refac
This commit is contained in:
parent
bb979c9a78
commit
eae35dddc2
@ -150,10 +150,11 @@ async def update_engine_url(
|
|||||||
else:
|
else:
|
||||||
url = form_data.AUTOMATIC1111_BASE_URL.strip("/")
|
url = form_data.AUTOMATIC1111_BASE_URL.strip("/")
|
||||||
try:
|
try:
|
||||||
r = requests.head(url)
|
r = requests.head(url)
|
||||||
|
r.raise_for_status()
|
||||||
app.state.config.AUTOMATIC1111_BASE_URL = url
|
app.state.config.AUTOMATIC1111_BASE_URL = url
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise HTTPException(status_code=400, detail="Invalid URL provided.")
|
raise HTTPException(status_code=400, detail=ERROR_MESSAGES.INVALID_URL)
|
||||||
|
|
||||||
if form_data.COMFYUI_BASE_URL == None:
|
if form_data.COMFYUI_BASE_URL == None:
|
||||||
app.state.config.COMFYUI_BASE_URL = COMFYUI_BASE_URL
|
app.state.config.COMFYUI_BASE_URL = COMFYUI_BASE_URL
|
||||||
@ -162,9 +163,10 @@ async def update_engine_url(
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
r = requests.head(url)
|
r = requests.head(url)
|
||||||
|
r.raise_for_status()
|
||||||
app.state.config.COMFYUI_BASE_URL = url
|
app.state.config.COMFYUI_BASE_URL = url
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise HTTPException(status_code=400, detail=ERROR_MESSAGES.DEFAULT(e))
|
raise HTTPException(status_code=400, detail=ERROR_MESSAGES.INVALID_URL)
|
||||||
|
|
||||||
if form_data.AUTOMATIC1111_API_AUTH == None:
|
if form_data.AUTOMATIC1111_API_AUTH == None:
|
||||||
app.state.config.AUTOMATIC1111_API_AUTH = AUTOMATIC1111_API_AUTH
|
app.state.config.AUTOMATIC1111_API_AUTH = AUTOMATIC1111_API_AUTH
|
||||||
|
@ -89,6 +89,7 @@ class ERROR_MESSAGES(str, Enum):
|
|||||||
OLLAMA_API_DISABLED = (
|
OLLAMA_API_DISABLED = (
|
||||||
"The Ollama API is disabled. Please enable it to use this feature."
|
"The Ollama API is disabled. Please enable it to use this feature."
|
||||||
)
|
)
|
||||||
|
INVALID_URL = "The URL you provided is invalid. Please double-check and try again."
|
||||||
|
|
||||||
|
|
||||||
class TASKS(str, Enum):
|
class TASKS(str, Enum):
|
||||||
|
Loading…
Reference in New Issue
Block a user