Run go fix
Signed-off-by: Александр Мелентьев <aleksandr4842@ya.ru>
This commit is contained in:
parent
94c13e13b8
commit
6a868b9e50
6 changed files with 11 additions and 14 deletions
3
.github/workflows/pr.yml
vendored
3
.github/workflows/pr.yml
vendored
|
|
@ -54,6 +54,9 @@ jobs:
|
|||
with:
|
||||
go-version-file: go.mod
|
||||
|
||||
- name: Run go generate
|
||||
run: go generate ./...
|
||||
|
||||
- name: Run go fix
|
||||
run: go fix ./...
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ type AuthCredential struct {
|
|||
AccessToken string `json:"access_token"`
|
||||
RefreshToken string `json:"refresh_token,omitempty"`
|
||||
AccountID string `json:"account_id,omitempty"`
|
||||
ExpiresAt time.Time `json:"expires_at,omitempty"`
|
||||
ExpiresAt time.Time `json:"expires_at"`
|
||||
Provider string `json:"provider"`
|
||||
AuthMethod string `json:"auth_method"`
|
||||
Email string `json:"email,omitempty"`
|
||||
|
|
|
|||
|
|
@ -315,10 +315,7 @@ func (c *OneBotChannel) sendAPIRequest(action string, params any, timeout time.D
|
|||
}
|
||||
|
||||
func (c *OneBotChannel) reconnectLoop() {
|
||||
interval := time.Duration(c.config.ReconnectInterval) * time.Second
|
||||
if interval < 5*time.Second {
|
||||
interval = 5 * time.Second
|
||||
}
|
||||
interval := max(time.Duration(c.config.ReconnectInterval)*time.Second, 5*time.Second)
|
||||
|
||||
for {
|
||||
select {
|
||||
|
|
@ -973,8 +970,8 @@ func (c *OneBotChannel) checkGroupTrigger(
|
|||
if prefix == "" {
|
||||
continue
|
||||
}
|
||||
if strings.HasPrefix(content, prefix) {
|
||||
return true, strings.TrimSpace(strings.TrimPrefix(content, prefix))
|
||||
if after, ok := strings.CutPrefix(content, prefix); ok {
|
||||
return true, strings.TrimSpace(after)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ type WeComBotReplyMessage struct {
|
|||
MsgType string `json:"msgtype"`
|
||||
Text struct {
|
||||
Content string `json:"content"`
|
||||
} `json:"text,omitempty"`
|
||||
} `json:"text"`
|
||||
}
|
||||
|
||||
// NewWeComBotChannel creates a new WeCom Bot channel instance
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ func (f *FlexibleStringSlice) UnmarshalJSON(data []byte) error {
|
|||
type Config struct {
|
||||
Agents AgentsConfig `json:"agents"`
|
||||
Bindings []AgentBinding `json:"bindings,omitempty"`
|
||||
Session SessionConfig `json:"session,omitempty"`
|
||||
Session SessionConfig `json:"session"`
|
||||
Channels ChannelsConfig `json:"channels"`
|
||||
Providers ProvidersConfig `json:"providers,omitempty"`
|
||||
Providers ProvidersConfig `json:"providers"`
|
||||
ModelList []ModelConfig `json:"model_list"` // New model-centric provider configuration
|
||||
Gateway GatewayConfig `json:"gateway"`
|
||||
Tools ToolsConfig `json:"tools"`
|
||||
|
|
|
|||
|
|
@ -13,10 +13,7 @@ func SplitMessage(content string, maxLen int) []string {
|
|||
var messages []string
|
||||
|
||||
// Dynamic buffer: 10% of maxLen, but at least 50 chars if possible
|
||||
codeBlockBuffer := max(maxLen/10, 50)
|
||||
if codeBlockBuffer > maxLen/2 {
|
||||
codeBlockBuffer = maxLen / 2
|
||||
}
|
||||
codeBlockBuffer := min(max(maxLen/10, 50), maxLen/2)
|
||||
|
||||
for len(content) > 0 {
|
||||
if len(content) <= maxLen {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue