Compare commits

..

15 Commits

7 changed files with 44 additions and 17 deletions

View File

@ -5,6 +5,9 @@ server:
ollama:
base_url: "http://172.17.0.1:11434"
# model: "qwen3:8b"
# generate_model: "qwen3:8b"
# mapping_model: "qwen3:8b"
model: "qwen3-coder:480b-cloud"
generate_model: "qwen3-coder:480b-cloud"
mapping_model: "deepseek-v3.2:cloud"
@ -36,7 +39,7 @@ sys:
channel_pool_len: 100
channel_pool_size: 32
llm_pool_len: 5
heartbeat_interval: 30
heartbeat_interval: 300
key: report-api
pollSize: 5 #连接池大小不配置或配置为0表示不启用连接池
minIdleConns: 2 #最小空闲连接数

View File

@ -20,7 +20,7 @@ import (
)
const DefaultInterval = 100 * time.Millisecond
const HeardBeatX = 100
const HeardBeatX = 1000
type SendCardClient struct {
Auth *Auth

View File

@ -125,7 +125,7 @@ func (w *statisticsOursProduct) formatContext(ctx context.Context, input *Statis
Time: time.Now(),
StartTime: startTime,
EndTime: endTime,
Title: fmt.Sprintf("截止 %s 亏损100以上我们的商品统计", endTimeStr),
Title: fmt.Sprintf("截止 %s 电商系统亏损100以上我们的商品统计", endTimeStr),
}, nil
}

View File

@ -8,6 +8,7 @@ import (
"net/url"
"os"
"sync"
"time"
"github.com/ollama/ollama/api"
)
@ -43,11 +44,12 @@ func (c *Client) ToolSelect(ctx context.Context, messages []api.Message, tools [
// 构建聊天请求
req := &api.ChatRequest{
Model: c.config.Model,
Messages: messages,
Stream: new(bool), // 设置为false不使用流式响应
Think: &api.ThinkValue{Value: false},
Tools: tools,
Model: c.config.Model,
Messages: messages,
Stream: new(bool), // 设置为false不使用流式响应
Think: &api.ThinkValue{Value: false},
Tools: tools,
KeepAlive: &api.Duration{Duration: 24 * time.Hour},
}
err = c.client.Chat(ctx, req, func(resp api.ChatResponse) error {
res = resp

View File

@ -403,10 +403,6 @@ func (b *BbxtTools) GetProfitRankingSum(now time.Time) (report *ReportRes, err e
// GetStatisOfficialProductSum 销量同比分析
func (b *BbxtTools) GetStatisOfficialProductSum(now time.Time, productName []string) (report *ReportRes, err error) {
var productMap = make(map[string]int)
for k, v := range productName {
productMap[v] = k
}
ct := []string{
time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location()).Format("2006-01-02 15:04:05"),
adjustedTime(now),
@ -428,7 +424,11 @@ func (b *BbxtTools) GetStatisOfficialProductSum(now time.Time, productName []str
if err != nil {
return
}
var total = make([][]string, len(ids))
// 创建临时map存储产品数据
productDataMap := make(map[string][]string)
var productNamesInResult []string
for _, v := range data.OfficialProductSum {
var (
yeterDatyDiff string
@ -444,7 +444,8 @@ func (b *BbxtTools) GetStatisOfficialProductSum(now time.Time, productName []str
} else {
lastWeekDiff = fmt.Sprintf("%s↓%d", GreenStyle, v.HistoryTwoDiff)
}
total[productMap[v.OfficialProductName]] = []string{
rowData := []string{
fmt.Sprintf("%s", v.OfficialProductName),
fmt.Sprintf("%d", v.CurrentNum),
fmt.Sprintf("%d", v.HistoryOneNum),
@ -453,7 +454,20 @@ func (b *BbxtTools) GetStatisOfficialProductSum(now time.Time, productName []str
lastWeekDiff,
}
// 存储到map中key为产品名
productDataMap[v.OfficialProductName] = rowData
productNamesInResult = append(productNamesInResult, v.OfficialProductName)
}
// 按照productName的顺序构建total
var total [][]string
for _, name := range productName {
if rowData, exists := productDataMap[name]; exists {
total = append(total, rowData)
}
}
timeCh := now.Format("1月2日15点")
title := "截至" + timeCh + "销售同比分析"
//总量生成excel

View File

@ -79,14 +79,22 @@ func Test_GetStatisOfficialProductSumDecline(t *testing.T) {
}
func Test_GetStatisOfficialProductSum(t *testing.T) {
run()
configs := configConfig
o, err := NewBbxtTools(nil, lsxd.NewLogin(configs, utils.NewRdb(configConfig)))
if err != nil {
panic(err)
}
s := "官方--美团外卖红包5元,官方--美团外卖红包10元,官方--饿了么超级会员月卡,官方--网易云黑胶vip月卡,官方--喜马拉雅巅峰会员月卡,官方--芒果-PC季卡,官方--芒果-PC月卡,官方--芒果-PC周卡,官方--腾讯-周卡,官方--优酷周卡,官方--QQ音乐-绿钻月卡,官方--爱奇艺-周卡,官方--腾讯-月卡,官方--腾讯-季卡,官方--腾讯-年卡,官方--优酷月卡,官方--优酷季卡,官方--优酷年卡,官方--爱奇艺-月卡,官方--爱奇艺-季卡,官方--爱奇艺-年卡"
report, err := o.GetStatisOfficialProductSum(time.Now(), strings.Split(s, ","))
s := "官方--腾讯-周卡,官方--腾讯-月卡,官方--腾讯-季卡,官方--腾讯-年卡,官方--优酷周卡,官方--优酷月卡,官方--优酷季卡,官方--优酷年卡,官方--爱奇艺-周卡,官方--爱奇艺-月卡,官方--爱奇艺-季卡,官方--爱奇艺-年卡,官方--芒果-PC周卡,官方--芒果-PC月卡,官方--芒果-PC季卡,官方--美团外卖红包5元,官方--美团外卖红包10元,官方--QQ音乐-绿钻月卡,官方--饿了么超级会员月卡,官方--网易云黑胶vip月卡,官方--喜马拉雅巅峰会员月卡"
now := time.Now()
noon := time.Date(
now.Year(),
now.Month(),
now.Day(),
12, 0, 0, 0,
now.Location(),
)
report, err := o.GetStatisOfficialProductSum(noon, strings.Split(s, ","))
t.Log(report, err)

Binary file not shown.