mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
feat: hide ask ai button when key is empty (#1515)
* Add option to hide Ask AI and update dev version * Fix formatting according to eslint * Replace option to hide Ask AI with auto hiding based on config * Fix golangci-lint errors * Remove showAskAI logic from OpenAPI
This commit is contained in:
@ -56,6 +56,10 @@ func (s *Server) registerSystemRoutes(g *echo.Group) {
|
||||
},
|
||||
StorageServiceID: api.DatabaseStorage,
|
||||
LocalStoragePath: "",
|
||||
OpenAIConfig: api.OpenAIConfig{
|
||||
Key: "",
|
||||
Host: "",
|
||||
},
|
||||
}
|
||||
|
||||
systemSettingList, err := s.Store.FindSystemSettingList(ctx, &api.SystemSettingFind{})
|
||||
@ -95,6 +99,13 @@ func (s *Server) registerSystemRoutes(g *echo.Group) {
|
||||
systemStatus.StorageServiceID = int(baseValue.(float64))
|
||||
} else if systemSetting.Name == api.SystemSettingLocalStoragePathName {
|
||||
systemStatus.LocalStoragePath = baseValue.(string)
|
||||
} else if systemSetting.Name == api.SystemSettingOpenAIConfigName {
|
||||
openAIConfig := api.OpenAIConfig{}
|
||||
err := json.Unmarshal([]byte(systemSetting.Value), &openAIConfig)
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to unmarshal system setting open ai config value").SetInternal(err)
|
||||
}
|
||||
systemStatus.OpenAIConfig = openAIConfig
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user