fix package

This commit is contained in:
lpf
2026-02-12 11:18:43 +08:00
parent 4956b1a014
commit cad0a4de5b
23 changed files with 1364 additions and 90 deletions

View File

@@ -8,9 +8,9 @@ import (
"strings"
"time"
"gitea.kkkk.dev/DBT/clawgo/pkg/logger"
"gitea.kkkk.dev/DBT/clawgo/pkg/providers"
"gitea.kkkk.dev/DBT/clawgo/pkg/skills"
"clawgo/pkg/logger"
"clawgo/pkg/providers"
"clawgo/pkg/skills"
)
type ContextBuilder struct {
@@ -159,8 +159,8 @@ func (cb *ContextBuilder) BuildMessages(history []providers.Message, summary str
// Log system prompt summary for debugging (debug mode only)
logger.DebugCF("agent", "System prompt built",
map[string]interface{}{
"total_chars": len(systemPrompt),
"total_lines": strings.Count(systemPrompt, "\n") + 1,
"total_chars": len(systemPrompt),
"total_lines": strings.Count(systemPrompt, "\n") + 1,
"section_count": strings.Count(systemPrompt, "\n\n---\n\n") + 1,
})

View File

@@ -15,13 +15,13 @@ import (
"regexp"
"strings"
"gitea.kkkk.dev/DBT/clawgo/pkg/bus"
"gitea.kkkk.dev/DBT/clawgo/pkg/config"
"gitea.kkkk.dev/DBT/clawgo/pkg/cron"
"gitea.kkkk.dev/DBT/clawgo/pkg/logger"
"gitea.kkkk.dev/DBT/clawgo/pkg/providers"
"gitea.kkkk.dev/DBT/clawgo/pkg/session"
"gitea.kkkk.dev/DBT/clawgo/pkg/tools"
"clawgo/pkg/bus"
"clawgo/pkg/config"
"clawgo/pkg/cron"
"clawgo/pkg/logger"
"clawgo/pkg/providers"
"clawgo/pkg/session"
"clawgo/pkg/tools"
)
type AgentLoop struct {
@@ -45,7 +45,7 @@ func NewAgentLoop(cfg *config.Config, msgBus *bus.MessageBus, provider providers
toolsRegistry.Register(&tools.WriteFileTool{})
toolsRegistry.Register(&tools.ListDirTool{})
toolsRegistry.Register(tools.NewExecTool(workspace))
if cs != nil {
toolsRegistry.Register(tools.NewRemindTool(cs))
}
@@ -214,12 +214,12 @@ func (al *AgentLoop) processMessage(ctx context.Context, msg bus.InboundMessage)
// Log LLM request details
logger.DebugCF("agent", "LLM request",
map[string]interface{}{
"iteration": iteration,
"model": al.model,
"messages_count": len(messages),
"tools_count": len(providerToolDefs),
"max_tokens": 8192,
"temperature": 0.7,
"iteration": iteration,
"model": al.model,
"messages_count": len(messages),
"tools_count": len(providerToolDefs),
"max_tokens": 8192,
"temperature": 0.7,
"system_prompt_len": len(messages[0].Content),
})
@@ -290,8 +290,8 @@ func (al *AgentLoop) processMessage(ctx context.Context, msg bus.InboundMessage)
argsPreview := truncate(string(argsJSON), 200)
logger.InfoCF("agent", fmt.Sprintf("Tool call: %s(%s)", tc.Name, argsPreview),
map[string]interface{}{
"tool": tc.Name,
"iteration": iteration,
"tool": tc.Name,
"iteration": iteration,
})
result, err := al.tools.Execute(ctx, tc.Name, tc.Arguments)
@@ -418,12 +418,12 @@ func (al *AgentLoop) processSystemMessage(ctx context.Context, msg bus.InboundMe
// Log LLM request details
logger.DebugCF("agent", "LLM request",
map[string]interface{}{
"iteration": iteration,
"model": al.model,
"messages_count": len(messages),
"tools_count": len(providerToolDefs),
"max_tokens": 8192,
"temperature": 0.7,
"iteration": iteration,
"model": al.model,
"messages_count": len(messages),
"tools_count": len(providerToolDefs),
"max_tokens": 8192,
"temperature": 0.7,
"system_prompt_len": len(messages[0].Content),
})

View File

@@ -4,7 +4,7 @@ import (
"context"
"fmt"
"gitea.kkkk.dev/DBT/clawgo/pkg/bus"
"clawgo/pkg/bus"
)
type Channel interface {

View File

@@ -9,22 +9,22 @@ import (
"log"
"sync"
"clawgo/pkg/bus"
"clawgo/pkg/config"
"github.com/open-dingtalk/dingtalk-stream-sdk-go/chatbot"
"github.com/open-dingtalk/dingtalk-stream-sdk-go/client"
"gitea.kkkk.dev/DBT/clawgo/pkg/bus"
"gitea.kkkk.dev/DBT/clawgo/pkg/config"
)
// DingTalkChannel implements the Channel interface for DingTalk (钉钉)
// It uses WebSocket for receiving messages via stream mode and API for sending
type DingTalkChannel struct {
*BaseChannel
config config.DingTalkConfig
clientID string
clientSecret string
streamClient *client.StreamClient
ctx context.Context
cancel context.CancelFunc
config config.DingTalkConfig
clientID string
clientSecret string
streamClient *client.StreamClient
ctx context.Context
cancel context.CancelFunc
// Map to store session webhooks for each chat
sessionWebhooks sync.Map // chatID -> sessionWebhook
}

View File

@@ -11,11 +11,11 @@ import (
"strings"
"time"
"clawgo/pkg/bus"
"clawgo/pkg/config"
"clawgo/pkg/logger"
"clawgo/pkg/voice"
"github.com/bwmarrin/discordgo"
"gitea.kkkk.dev/DBT/clawgo/pkg/bus"
"gitea.kkkk.dev/DBT/clawgo/pkg/config"
"gitea.kkkk.dev/DBT/clawgo/pkg/logger"
"gitea.kkkk.dev/DBT/clawgo/pkg/voice"
)
type DiscordChannel struct {

View File

@@ -12,9 +12,9 @@ import (
larkim "github.com/larksuite/oapi-sdk-go/v3/service/im/v1"
larkws "github.com/larksuite/oapi-sdk-go/v3/ws"
"gitea.kkkk.dev/DBT/clawgo/pkg/bus"
"gitea.kkkk.dev/DBT/clawgo/pkg/config"
"gitea.kkkk.dev/DBT/clawgo/pkg/logger"
"clawgo/pkg/bus"
"clawgo/pkg/config"
"clawgo/pkg/logger"
)
type FeishuChannel struct {

View File

@@ -7,9 +7,9 @@ import (
"net"
"sync"
"gitea.kkkk.dev/DBT/clawgo/pkg/bus"
"gitea.kkkk.dev/DBT/clawgo/pkg/config"
"gitea.kkkk.dev/DBT/clawgo/pkg/logger"
"clawgo/pkg/bus"
"clawgo/pkg/config"
"clawgo/pkg/logger"
)
type MaixCamChannel struct {

View File

@@ -11,9 +11,9 @@ import (
"fmt"
"sync"
"gitea.kkkk.dev/DBT/clawgo/pkg/bus"
"gitea.kkkk.dev/DBT/clawgo/pkg/config"
"gitea.kkkk.dev/DBT/clawgo/pkg/logger"
"clawgo/pkg/bus"
"clawgo/pkg/config"
"clawgo/pkg/logger"
)
type Manager struct {

View File

@@ -13,9 +13,9 @@ import (
"github.com/tencent-connect/botgo/token"
"golang.org/x/oauth2"
"gitea.kkkk.dev/DBT/clawgo/pkg/bus"
"gitea.kkkk.dev/DBT/clawgo/pkg/config"
"gitea.kkkk.dev/DBT/clawgo/pkg/logger"
"clawgo/pkg/bus"
"clawgo/pkg/config"
"clawgo/pkg/logger"
)
type QQChannel struct {

View File

@@ -16,9 +16,9 @@ import (
"github.com/mymmrac/telego"
"github.com/mymmrac/telego/telegoutil"
"gitea.kkkk.dev/DBT/clawgo/pkg/bus"
"gitea.kkkk.dev/DBT/clawgo/pkg/config"
"gitea.kkkk.dev/DBT/clawgo/pkg/voice"
"clawgo/pkg/bus"
"clawgo/pkg/config"
"clawgo/pkg/voice"
)
type TelegramChannel struct {
@@ -125,14 +125,14 @@ func (c *TelegramChannel) Send(ctx context.Context, msg bus.OutboundMessage) err
// Try to edit placeholder
if pID, ok := c.placeholders.Load(msg.ChatID); ok {
c.placeholders.Delete(msg.ChatID)
_, err := c.bot.EditMessageText(ctx, &telego.EditMessageTextParams{
ChatID: chatID,
MessageID: pID.(int),
Text: htmlContent,
ParseMode: telego.ModeHTML,
})
if err == nil {
return nil
}

View File

@@ -10,8 +10,8 @@ import (
"github.com/gorilla/websocket"
"gitea.kkkk.dev/DBT/clawgo/pkg/bus"
"gitea.kkkk.dev/DBT/clawgo/pkg/config"
"clawgo/pkg/bus"
"clawgo/pkg/config"
)
type WhatsAppChannel struct {

View File

@@ -15,7 +15,7 @@ import (
"net/http"
"strings"
"gitea.kkkk.dev/DBT/clawgo/pkg/config"
"clawgo/pkg/config"
)
type HTTPProvider struct {

View File

@@ -6,8 +6,8 @@ import (
"net/http"
"time"
"gitea.kkkk.dev/DBT/clawgo/pkg/config"
"gitea.kkkk.dev/DBT/clawgo/pkg/logger"
"clawgo/pkg/config"
"clawgo/pkg/logger"
)
type Server struct {
@@ -35,7 +35,7 @@ func (s *Server) Start() error {
logger.InfoCF("server", "Starting HTTP server", map[string]interface{}{
"addr": addr,
})
// Check/log indicating it's ready for reverse proxying (per requirement)
logger.InfoC("server", "Server ready for reverse proxying")

View File

@@ -7,7 +7,7 @@ import (
"sync"
"time"
"gitea.kkkk.dev/DBT/clawgo/pkg/providers"
"clawgo/pkg/providers"
)
type Session struct {

View File

@@ -6,7 +6,7 @@ import (
"sync"
"time"
"gitea.kkkk.dev/DBT/clawgo/pkg/logger"
"clawgo/pkg/logger"
)
type ToolRegistry struct {

View File

@@ -5,7 +5,7 @@ import (
"fmt"
"time"
"gitea.kkkk.dev/DBT/clawgo/pkg/cron"
"clawgo/pkg/cron"
)
type RemindTool struct {

View File

@@ -6,8 +6,8 @@ import (
"sync"
"time"
"gitea.kkkk.dev/DBT/clawgo/pkg/bus"
"gitea.kkkk.dev/DBT/clawgo/pkg/providers"
"clawgo/pkg/bus"
"clawgo/pkg/providers"
)
type SubagentTask struct {

View File

@@ -12,7 +12,7 @@ import (
"path/filepath"
"time"
"gitea.kkkk.dev/DBT/clawgo/pkg/logger"
"clawgo/pkg/logger"
)
type GroqTranscriber struct {