chore
This commit is contained in:
parent
d93157bde4
commit
9945338458
@ -1,6 +1,6 @@
|
|||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
from fastapi import APIRouter, HTTPException, Response, status
|
from fastapi import APIRouter, HTTPException, Response, status as Status
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
from langchain.llms import RWKV
|
from langchain.llms import RWKV
|
||||||
from utils.rwkv import *
|
from utils.rwkv import *
|
||||||
@ -33,7 +33,7 @@ class SwitchModelBody(BaseModel):
|
|||||||
@router.post("/switch-model")
|
@router.post("/switch-model")
|
||||||
def switch_model(body: SwitchModelBody, response: Response):
|
def switch_model(body: SwitchModelBody, response: Response):
|
||||||
if global_var.get(global_var.Model_Status) is global_var.ModelStatus.Loading:
|
if global_var.get(global_var.Model_Status) is global_var.ModelStatus.Loading:
|
||||||
response.status_code = status.HTTP_304_NOT_MODIFIED
|
response.status_code = Status.HTTP_304_NOT_MODIFIED
|
||||||
return
|
return
|
||||||
|
|
||||||
global_var.set(global_var.Model_Status, global_var.ModelStatus.Offline)
|
global_var.set(global_var.Model_Status, global_var.ModelStatus.Offline)
|
||||||
@ -55,7 +55,7 @@ def switch_model(body: SwitchModelBody, response: Response):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
global_var.set(global_var.Model_Status, global_var.ModelStatus.Offline)
|
global_var.set(global_var.Model_Status, global_var.ModelStatus.Offline)
|
||||||
raise HTTPException(status.HTTP_500_INTERNAL_SERVER_ERROR, "failed to load")
|
raise HTTPException(Status.HTTP_500_INTERNAL_SERVER_ERROR, "failed to load")
|
||||||
|
|
||||||
if global_var.get(global_var.Model_Config) is None:
|
if global_var.get(global_var.Model_Config) is None:
|
||||||
global_var.set(
|
global_var.set(
|
||||||
|
Loading…
Reference in New Issue
Block a user