This commit is contained in:
2026-06-17 20:18:37 +08:00
parent 2840aca69b
commit e2bf6aa173
12 changed files with 1102 additions and 2 deletions
+17 -1
View File
@@ -7,9 +7,13 @@ import (
)
const allowEncryptedForwardingLabel = "Allow encrypted MQTT packets to be forwarded when they cannot be decrypted"
const llmQueueEnabledLabel = "Enable LLM message queue"
const llmIncludeChannelLabel = "Include channel messages in LLM queue"
type runtimeSettingsRequest struct {
AllowEncryptedForwarding bool `json:"allow_encrypted_forwarding"`
LLMQueueEnabled bool `json:"llm_queue_enabled"`
LLMIncludeChannelMessages bool `json:"llm_include_channel_messages"`
}
func registerAdminRuntimeSettingsRoutes(r gin.IRouter, store *store, settings *runtimeSettingsCache) {
@@ -32,6 +36,14 @@ func registerAdminRuntimeSettingsRoutes(r gin.IRouter, store *store, settings *r
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}
if _, err := store.SetBoolRuntimeSetting(runtimeSettingLLMQueueEnabled, req.LLMQueueEnabled, llmQueueEnabledLabel); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}
if _, err := store.SetBoolRuntimeSetting(runtimeSettingLLMQueueIncludeChannel, req.LLMIncludeChannelMessages, llmIncludeChannelLabel); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}
if settings != nil {
if err := settings.Reload(store); err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
@@ -48,5 +60,9 @@ func registerAdminRuntimeSettingsRoutes(r gin.IRouter, store *store, settings *r
}
func runtimeSettingsDTO(settings runtimeSettingsSnapshot) gin.H {
return gin.H{"allow_encrypted_forwarding": settings.AllowEncryptedForwarding}
return gin.H{
"allow_encrypted_forwarding": settings.AllowEncryptedForwarding,
"llm_queue_enabled": settings.LLMQueueEnabled,
"llm_include_channel_messages": settings.LLMIncludeChannel,
}
}