feat: fetch for the assistant with Поиск on - a page's main text for the model, the server's own network out of reach; shorter words in Настройки and the chat; the + menu's roots a step left. Also files from panes into the chat, docview and drag fixes (by the user)
This commit is contained in:
1 parent
84b42c5369
commit
ae8fffe7d8
17 files changed
+712
-102
No files matched your search
@@ -36,8 +36,8 @@ const (
|
||||
DefaultAIURL = "https://agentproxy.minomix.ru"
|
||||
)
|
||||
|
||||
// aiUserKey is the config key of a user's own switch: the assistant is off
|
||||
// for everyone until they turn it on in their profile.
|
||||
// aiUserKey is the config key of a user's own switch. Missing means on by
|
||||
// default; an explicit "0" means the user turned it off.
|
||||
func aiUserKey(id int64) string { return "ai_user_" + strconv.FormatInt(id, 10) }
|
||||
|
||||
type aiConfig struct{ Type, URL, Key, Model string }
|
||||
@@ -634,7 +634,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 != "1" {
|
||||
if on, _ := s.db.GetConfig(aiUserKey(a.ID)); on == "0" {
|
||||
http.Error(w, "ассистент выключен в профиле", http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
@@ -866,7 +866,7 @@ func (s *Server) handleAINote(w http.ResponseWriter, r *http.Request) {
|
||||
// GET /api/panel/ai - whether the assistant is on for this user.
|
||||
func (s *Server) handleAIState(w http.ResponseWriter, r *http.Request) {
|
||||
on, _ := s.db.GetConfig(aiUserKey(s.currentAdmin(r).ID))
|
||||
writeJSON(w, map[string]any{"on": on == "1"})
|
||||
writeJSON(w, map[string]any{"on": on != "0"})
|
||||
}
|
||||
|
||||
// POST /api/panel/ai/toggle - {on}: the user's own switch.
|
||||
@@ -878,7 +878,7 @@ func (s *Server) handleAIToggle(w http.ResponseWriter, r *http.Request) {
|
||||
writeJSON(w, map[string]any{"ok": false, "error": "плохой запрос"})
|
||||
return
|
||||
}
|
||||
v := ""
|
||||
v := "0"
|
||||
if in.On {
|
||||
v = "1"
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user