simplified AI enable check for self hosted models
This commit is contained in:
+3
-18
@@ -1135,6 +1135,8 @@ func handleInfo(resp http.ResponseWriter, request *http.Request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aiEnabled := os.Getenv("OPENAI_API_URL") != "" && os.Getenv("AI_MODEL") != ""
|
||||||
|
|
||||||
returnValue := shuffle.HandleInfo{
|
returnValue := shuffle.HandleInfo{
|
||||||
Success: true,
|
Success: true,
|
||||||
Username: userInfo.Username,
|
Username: userInfo.Username,
|
||||||
@@ -1159,7 +1161,7 @@ func handleInfo(resp http.ResponseWriter, request *http.Request) {
|
|||||||
ActiveApps: activatedAppIds,
|
ActiveApps: activatedAppIds,
|
||||||
Theme: userInfo.Theme,
|
Theme: userInfo.Theme,
|
||||||
OrgStatus: parsedStatus,
|
OrgStatus: parsedStatus,
|
||||||
AIEnabled: org.LocalAIEnabled,
|
AIEnabled: aiEnabled,
|
||||||
}
|
}
|
||||||
|
|
||||||
returnData, err := json.Marshal(returnValue)
|
returnData, err := json.Marshal(returnValue)
|
||||||
@@ -5481,23 +5483,6 @@ func initHandlers() {
|
|||||||
|
|
||||||
r.Use(shuffle.RequestMiddleware)
|
r.Use(shuffle.RequestMiddleware)
|
||||||
http.Handle("/", r)
|
http.Handle("/", r)
|
||||||
|
|
||||||
go func() {
|
|
||||||
log.Printf("[DEBUG] Starting AI availability check for all organizations")
|
|
||||||
activeOrgs, err := shuffle.GetAllOrgs(ctx)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("[ERROR] Error getting organizations for AI availability check: %s", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, org := range activeOrgs {
|
|
||||||
if len(org.Id) == 0 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
go shuffle.CheckAndUpdateAIAvailability(ctx, org.Id)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Had to move away from mux, which means Method is fucked up right now.
|
// Had to move away from mux, which means Method is fucked up right now.
|
||||||
|
|||||||
Reference in New Issue
Block a user