fix: the assistant's web search and page reading on by default, as the chat - they refused («ассистент выключен в профиле») anyone who never touched the switch
This commit is contained in:
1 parent
114f8b1e1b
commit
054fc97da8
4 files changed
+51
-3
No files matched your search
@@ -47,6 +47,12 @@ func aiNativeKey(id string) string { return "ai_native_" + id }
|
||||
// default; an explicit "0" means the user turned it off.
|
||||
func aiUserKey(id int64) string { return "ai_user_" + strconv.FormatInt(id, 10) }
|
||||
|
||||
// aiOn: the user has the assistant - on unless turned off.
|
||||
func (s *Server) aiOn(id int64) bool {
|
||||
v, _ := s.db.GetConfig(aiUserKey(id))
|
||||
return v != "0"
|
||||
}
|
||||
|
||||
// aiConfig is one model the assistant can ask: its id and the names the chat
|
||||
// shows (Short, up to 12 characters, on the button of the model in use), the
|
||||
// kind of API, its address, model and key.
|
||||
@@ -833,7 +839,7 @@ func (s *Server) aiAdopt(owner int64) {
|
||||
// text with "[ошибка: …]".
|
||||
func (s *Server) handleAIChat(w http.ResponseWriter, r *http.Request) {
|
||||
a := s.currentAdmin(r)
|
||||
if on, _ := s.db.GetConfig(aiUserKey(a.ID)); on == "0" {
|
||||
if !s.aiOn(a.ID) {
|
||||
http.Error(w, "ассистент выключен в профиле", http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user