Run go fix

Signed-off-by: Александр Мелентьев <aleksandr4842@ya.ru>
This commit is contained in:
Александр Мелентьев 2026-02-22 10:45:01 +03:00
parent 94c13e13b8
commit 6a868b9e50
6 changed files with 11 additions and 14 deletions

View file

@ -54,6 +54,9 @@ jobs:
with: with:
go-version-file: go.mod go-version-file: go.mod
- name: Run go generate
run: go generate ./...
- name: Run go fix - name: Run go fix
run: go fix ./... run: go fix ./...

View file

@ -11,7 +11,7 @@ type AuthCredential struct {
AccessToken string `json:"access_token"` AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token,omitempty"` RefreshToken string `json:"refresh_token,omitempty"`
AccountID string `json:"account_id,omitempty"` AccountID string `json:"account_id,omitempty"`
ExpiresAt time.Time `json:"expires_at,omitempty"` ExpiresAt time.Time `json:"expires_at"`
Provider string `json:"provider"` Provider string `json:"provider"`
AuthMethod string `json:"auth_method"` AuthMethod string `json:"auth_method"`
Email string `json:"email,omitempty"` Email string `json:"email,omitempty"`

View file

@ -315,10 +315,7 @@ func (c *OneBotChannel) sendAPIRequest(action string, params any, timeout time.D
} }
func (c *OneBotChannel) reconnectLoop() { func (c *OneBotChannel) reconnectLoop() {
interval := time.Duration(c.config.ReconnectInterval) * time.Second interval := max(time.Duration(c.config.ReconnectInterval)*time.Second, 5*time.Second)
if interval < 5*time.Second {
interval = 5 * time.Second
}
for { for {
select { select {
@ -973,8 +970,8 @@ func (c *OneBotChannel) checkGroupTrigger(
if prefix == "" { if prefix == "" {
continue continue
} }
if strings.HasPrefix(content, prefix) { if after, ok := strings.CutPrefix(content, prefix); ok {
return true, strings.TrimSpace(strings.TrimPrefix(content, prefix)) return true, strings.TrimSpace(after)
} }
} }

View file

@ -87,7 +87,7 @@ type WeComBotReplyMessage struct {
MsgType string `json:"msgtype"` MsgType string `json:"msgtype"`
Text struct { Text struct {
Content string `json:"content"` Content string `json:"content"`
} `json:"text,omitempty"` } `json:"text"`
} }
// NewWeComBotChannel creates a new WeCom Bot channel instance // NewWeComBotChannel creates a new WeCom Bot channel instance

View file

@ -49,9 +49,9 @@ func (f *FlexibleStringSlice) UnmarshalJSON(data []byte) error {
type Config struct { type Config struct {
Agents AgentsConfig `json:"agents"` Agents AgentsConfig `json:"agents"`
Bindings []AgentBinding `json:"bindings,omitempty"` Bindings []AgentBinding `json:"bindings,omitempty"`
Session SessionConfig `json:"session,omitempty"` Session SessionConfig `json:"session"`
Channels ChannelsConfig `json:"channels"` Channels ChannelsConfig `json:"channels"`
Providers ProvidersConfig `json:"providers,omitempty"` Providers ProvidersConfig `json:"providers"`
ModelList []ModelConfig `json:"model_list"` // New model-centric provider configuration ModelList []ModelConfig `json:"model_list"` // New model-centric provider configuration
Gateway GatewayConfig `json:"gateway"` Gateway GatewayConfig `json:"gateway"`
Tools ToolsConfig `json:"tools"` Tools ToolsConfig `json:"tools"`

View file

@ -13,10 +13,7 @@ func SplitMessage(content string, maxLen int) []string {
var messages []string var messages []string
// Dynamic buffer: 10% of maxLen, but at least 50 chars if possible // Dynamic buffer: 10% of maxLen, but at least 50 chars if possible
codeBlockBuffer := max(maxLen/10, 50) codeBlockBuffer := min(max(maxLen/10, 50), maxLen/2)
if codeBlockBuffer > maxLen/2 {
codeBlockBuffer = maxLen / 2
}
for len(content) > 0 { for len(content) > 0 {
if len(content) <= maxLen { if len(content) <= maxLen {