Compare commits
No commits in common. "d3fe7ded1aa94f916dec80f604e84be961bc6c3b" and "94c4a8fae82277c4601847a20b1959fb08b6c4ec" have entirely different histories.
d3fe7ded1a
...
94c4a8fae8
|
|
@ -142,7 +142,7 @@ eino_tools:
|
|||
# == 通用工具 ==
|
||||
# 表格转图片
|
||||
excel2pic:
|
||||
base_url: "http://192.168.6.109:8010/api/v1/convert"
|
||||
base_url: "http://excel2pic:8000/api/v1/convert"
|
||||
|
||||
dingtalk:
|
||||
api_key: "dingsbbntrkeiyazcfdg"
|
||||
|
|
|
|||
|
|
@ -378,9 +378,7 @@ func (d *DingTalkBotBiz) HandleStreamRes(ctx context.Context, data *chatbot.BotC
|
|||
}
|
||||
|
||||
func (d *DingTalkBotBiz) SendReport(ctx context.Context, groupInfo *model.AiBotGroup, report *bbxt.ReportRes) (err error) {
|
||||
if report == nil {
|
||||
return errors.New("report is nil")
|
||||
}
|
||||
|
||||
reportChan := make(chan string, 10)
|
||||
defer close(reportChan)
|
||||
reportChan <- report.Title
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
package biz
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test_report(t *testing.T) {
|
||||
run()
|
||||
chatId, err := groupConfigBiz.GetReportLists(context.Background(), nil)
|
||||
t.Log(chatId, err)
|
||||
}
|
||||
|
|
@ -10,7 +10,6 @@ import (
|
|||
"ai_scheduler/internal/pkg/l_request"
|
||||
"ai_scheduler/internal/tools/bbxt"
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"strings"
|
||||
"time"
|
||||
|
|
@ -112,10 +111,6 @@ func (q *QywxAppBiz) SendReport(ctx context.Context, groupInfo *model.AiBotGroup
|
|||
|
||||
// SendReportV2 发送到货易通指定的群聊
|
||||
func (q *QywxAppBiz) SendReportHYT(ctx context.Context, groupInfo *model.AiBotGroupQywx, report *bbxt.ReportRes) (err error) {
|
||||
|
||||
if report == nil {
|
||||
return fmt.Errorf("report is nil")
|
||||
}
|
||||
// 文本消息
|
||||
err = q.sendReportHYT(groupInfo, &bbxt.ReportRes{
|
||||
Title: report.Title,
|
||||
|
|
|
|||
|
|
@ -2,17 +2,8 @@ package biz
|
|||
|
||||
import (
|
||||
"ai_scheduler/internal/biz/handle/qywx"
|
||||
"ai_scheduler/internal/biz/tools_regis"
|
||||
"ai_scheduler/internal/config"
|
||||
"ai_scheduler/internal/data/impl"
|
||||
"ai_scheduler/internal/domain/component"
|
||||
"ai_scheduler/internal/domain/component/callback"
|
||||
"ai_scheduler/internal/domain/repo"
|
||||
"ai_scheduler/internal/domain/workflow"
|
||||
"ai_scheduler/internal/pkg"
|
||||
"ai_scheduler/internal/pkg/lsxd"
|
||||
"ai_scheduler/internal/pkg/utils_ollama"
|
||||
"ai_scheduler/internal/pkg/utils_oss"
|
||||
"ai_scheduler/utils"
|
||||
"context"
|
||||
"testing"
|
||||
|
|
@ -27,7 +18,6 @@ func Test_InitGroup(t *testing.T) {
|
|||
var (
|
||||
configConfig *config.Config
|
||||
qywxAppBiz *QywxAppBiz
|
||||
groupConfigBiz *GroupConfigBiz
|
||||
)
|
||||
|
||||
func run() {
|
||||
|
|
@ -38,21 +28,6 @@ func run() {
|
|||
botGroupQywxImpl := impl.NewBotGroupQywxImpl(db)
|
||||
qywxAuth := qywx.NewAuth(configConfig, rdb)
|
||||
group := qywx.NewGroup(botGroupQywxImpl, qywxAuth)
|
||||
sessionImpl := impl.NewSessionImpl(db)
|
||||
other := qywx.NewOther(qywxAuth)
|
||||
repos := repo.NewRepos(sessionImpl, configConfig, rdb)
|
||||
pkgRdb := pkg.NewRdb(configConfig)
|
||||
redisManager := callback.NewRedisManager(pkgRdb)
|
||||
login := lsxd.NewLogin(configConfig, rdb)
|
||||
components := component.NewComponents(redisManager, login)
|
||||
repos = repo.NewRepos(sessionImpl, configConfig, rdb)
|
||||
botToolsImpl := impl.NewBotToolsImpl(db)
|
||||
toolRegis := tools_regis.NewToolsRegis(botToolsImpl)
|
||||
utils_ossClient, _ := utils_oss.NewClient(configConfig)
|
||||
client, _, _ := utils_ollama.NewClient(configConfig)
|
||||
|
||||
registry := workflow.NewRegistry(configConfig, client, repos, components)
|
||||
botGroupConfigImpl := impl.NewBotGroupConfigImpl(db)
|
||||
qywxAppBiz = NewQywxAppBiz(configConfig, botGroupQywxImpl, group, other)
|
||||
groupConfigBiz = NewGroupConfigBiz(toolRegis, utils_ossClient, botGroupConfigImpl, registry, configConfig)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import (
|
|||
"ai_scheduler/internal/data/impl"
|
||||
"ai_scheduler/internal/data/model"
|
||||
"ai_scheduler/internal/entitys"
|
||||
"ai_scheduler/internal/pkg/util"
|
||||
"context"
|
||||
"time"
|
||||
|
||||
|
|
@ -152,24 +151,9 @@ func (s *SessionBiz) SessionList(ctx context.Context, req *entitys.SessionListRe
|
|||
list, err = s.sessionRepo.FindAll(
|
||||
s.sessionRepo.WithUserId(req.UserId), // 条件:用户ID
|
||||
s.sessionRepo.WithSysId(req.SysId), // 条件:系统ID
|
||||
s.sessionRepo.WithDeleteAt(), // 条件:未删除
|
||||
s.sessionRepo.PaginateScope(req.Page, req.PageSize), // 分页
|
||||
s.sessionRepo.OrderByDesc("create_at"), // 排序:按创建时间降序
|
||||
)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DeleteSession 删除会话
|
||||
func (s *SessionBiz) DeleteSession(ctx context.Context, req *entitys.SessionDeleteRequest) error {
|
||||
err := s.sessionRepo.Update(
|
||||
&model.AiSession{
|
||||
DeleteAt: util.AnyToPoint(time.Now()), // 设置删除时间
|
||||
},
|
||||
s.sessionRepo.WithSessionId(req.SessionId), // 条件:会话ID
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,9 +4,8 @@ import (
|
|||
"ai_scheduler/internal/data/model"
|
||||
"ai_scheduler/tmpl/dataTemp"
|
||||
"ai_scheduler/utils"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
)
|
||||
|
||||
type SessionImpl struct {
|
||||
|
|
@ -47,10 +46,3 @@ func (impl *SessionImpl) WithSessionId(sessionId interface{}) CondFunc {
|
|||
return db.Where("session_id = ?", sessionId)
|
||||
}
|
||||
}
|
||||
|
||||
// WithDeletedAt 条件:是否删除
|
||||
func (impl *SessionImpl) WithDeleteAt() CondFunc {
|
||||
return func(db *gorm.DB) *gorm.DB {
|
||||
return db.Where("delete_at IS NULL")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,3 @@ type UseFulRequest struct {
|
|||
HisId int64 `json:"his_id"`
|
||||
Useful int32 `json:"useful"`
|
||||
}
|
||||
|
||||
type SessionDeleteRequest struct {
|
||||
SessionId string `json:"session_id"`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,13 +41,13 @@ func (c *CronServer) InitJobs(ctx context.Context) {
|
|||
c.jobs = []*cronJob{
|
||||
{
|
||||
Func: c.cronService.CronReportSendDingTalk,
|
||||
Name: "直连天下报表推送(钉钉)",
|
||||
Schedule: "20 12,18,23 * * *",
|
||||
Name: "直连天下报表推送",
|
||||
Schedule: "0 12,18,23 * * *",
|
||||
},
|
||||
{
|
||||
Func: c.cronService.CronReportSendQywx,
|
||||
Name: "直连天下报表推送(微信)",
|
||||
Schedule: "20 12,18,23 * * *",
|
||||
Name: "直连天下报表推送",
|
||||
Schedule: "0 12,18,23 * * *",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ func SetupRoutes(app *fiber.App, ChatService *services.ChatService, sessionServi
|
|||
r.Post("/session/new", sessionService.NewSession)
|
||||
r.Post("/session/init", sessionService.SessionInit) // 会话初始化,不存在则创建,存在则返回会话ID和默认条数会话历史
|
||||
r.Post("/session/list", sessionService.SessionList)
|
||||
r.Post("/session/delete", sessionService.DeleteSession) // 删除会话
|
||||
|
||||
r.Post("/sys/tasks", task.Tasks)
|
||||
// 评价
|
||||
|
|
|
|||
|
|
@ -69,21 +69,3 @@ func (s *SessionService) SessionList(c *fiber.Ctx) error {
|
|||
"session_list": sessionList,
|
||||
})
|
||||
}
|
||||
|
||||
// DeleteSession 删除会话
|
||||
func (s *SessionService) DeleteSession(c *fiber.Ctx) error {
|
||||
req := &entitys.SessionDeleteRequest{}
|
||||
if err := c.BodyParser(req); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err := s.sessionBiz.DeleteSession(c.Context(), req)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return c.JSON(fiber.Map{
|
||||
"message": "success",
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,8 +72,7 @@ func Test_GetStatisOfficialProductSumDecline(t *testing.T) {
|
|||
}
|
||||
s := "官方--腾讯-周卡,官方--腾讯-月卡,官方--腾讯-季卡,官方--腾讯-年卡,官方--优酷周卡,官方--优酷月卡,官方--优酷季卡,官方--优酷年卡,官方--爱奇艺-周卡,官方--爱奇艺-月卡,官方--爱奇艺-季卡,官方--爱奇艺-年卡,官方--芒果-PC周卡,官方--芒果-PC月卡,官方--芒果-PC季卡,官方--美团外卖红包5元,官方--美团外卖红包10元,官方--QQ音乐-绿钻月卡,官方--饿了么超级会员月卡,官方--网易云黑胶vip月卡,官方--喜马拉雅巅峰会员月卡"
|
||||
//s := "官方--QQ音乐-绿钻月卡"
|
||||
now := time.Now()
|
||||
report, err := o.GetStatisOfficialProductSumDecline(time.Date(now.Year(), now.Month(), now.Day(), 12, 0, 0, 0, now.Location()), 1000, strings.Split(s, ","), -150)
|
||||
report, err := o.GetStatisOfficialProductSumDecline(time.Now(), 1000, strings.Split(s, ","), -150)
|
||||
|
||||
t.Log(report, err)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue