Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
bd4e02f
build(deps): bump github.com/meilisearch/meilisearch-go
dependabot[bot] Feb 11, 2026
47c3558
feat(chatv2): add agent mode chat module with streaming, MCP and tools
hugefiver Feb 28, 2026
e332502
chatv2: add unit tests and fix lint issues
hugefiver Feb 28, 2026
184ebd1
test: disable flaky b23.tv short link tests
hugefiver Feb 28, 2026
4ea8a2c
chatv2: add 32-bit build constraints for sonic/eino incompatibility
hugefiver Feb 28, 2026
c1b6237
chatv2: fix PR review issues
hugefiver Feb 28, 2026
9f83855
chatv2: fix Copilot review issues
hugefiver Feb 28, 2026
45e1d48
chatv2: fix PR review issues (round 3)
hugefiver Feb 28, 2026
a81fa43
Merge pull request #717 from CSUSTers/feat-chatv2
hugefiver Feb 28, 2026
80f4881
feat(chatv2): add progress tracking and image analysis tools with con…
hugefiver Feb 28, 2026
bab2158
refactor: update interface{} to any type and improve string parsing
hugefiver Feb 28, 2026
a2b796c
build(deps): bump github.com/cloudwego/eino from 0.7.36 to 0.7.37 (#722)
dependabot[bot] Mar 5, 2026
709febf
build(deps): bump github.com/samber/lo from 1.52.0 to 1.53.0 (#721)
dependabot[bot] Mar 5, 2026
cecc206
build(deps): bump github.com/mark3labs/mcp-go from 0.43.0 to 0.44.1 (…
dependabot[bot] Mar 5, 2026
d0b15e7
build(deps): bump github.com/mark3labs/mcp-go from 0.44.1 to 0.45.0
dependabot[bot] Mar 6, 2026
9412add
build(deps): bump golang.org/x/time from 0.14.0 to 0.15.0 (#726)
dependabot[bot] Mar 10, 2026
2ba2d56
build(deps): bump golang.org/x/sync from 0.19.0 to 0.20.0 (#727)
dependabot[bot] Mar 10, 2026
1b55ecb
build(deps): bump golang.org/x/text from 0.32.0 to 0.35.0 (#730)
dependabot[bot] Mar 12, 2026
4d71fcf
build(deps): bump github.com/cloudwego/eino-ext/components/model/open…
dependabot[bot] Mar 12, 2026
846bbb8
build(deps): bump golang.org/x/image from 0.34.0 to 0.37.0 (#732)
dependabot[bot] Mar 13, 2026
38257df
build(deps): bump github.com/cloudwego/eino from 0.7.37 to 0.8.3
dependabot[bot] Mar 16, 2026
331db68
build(deps): bump github.com/cloudwego/eino from 0.8.3 to 0.8.4 (#735)
dependabot[bot] Mar 19, 2026
e88e660
build(deps): bump github.com/cloudwego/eino-ext/components/model/open…
dependabot[bot] Mar 19, 2026
943a4c8
build(deps): bump golang.org/x/image from 0.37.0 to 0.38.0
dependabot[bot] Mar 24, 2026
93a6dd0
build(deps): bump github.com/cloudwego/eino from 0.8.4 to 0.8.5
dependabot[bot] Mar 24, 2026
a4b4c7b
build(deps): bump github.com/mark3labs/mcp-go from 0.45.0 to 0.46.0
dependabot[bot] Mar 26, 2026
f2b119d
fix: harden Telegram parse-mode escaping for agent replies
Anthony-Hoo Mar 30, 2026
49dd949
feat(chatv2): 优化代理容错机制与区域化输出体验
Anthony-Hoo Mar 30, 2026
5ca239e
feat(chatv2): 增强多模态输入的历史消息上下文支持
Anthony-Hoo Mar 30, 2026
e91c309
fix: make linter happy
Anthony-Hoo Mar 30, 2026
6c594a9
build(deps): bump golang.org/x/image from 0.34.0 to 0.38.0
dependabot[bot] Mar 30, 2026
41ba20a
feat(chatv2): 增强工具系统 — skills集成、MCP/MCPO重构、错误容错与多模态兼容
hugefiver Apr 1, 2026
151f05c
feat(chatv2): handle unknown tool calls gracefully via UnknownToolsHa…
hugefiver Apr 1, 2026
80eb355
build(deps): bump github.com/cloudwego/eino-ext/components/model/openai
dependabot[bot] Mar 31, 2026
76e0136
Merge branch 'dev' into dependabot/go_modules/golang.org/x/image-0.38.0
hugefiver Apr 1, 2026
ec421b3
Merge pull request #739 from CSUSTers/dependabot/go_modules/golang.or…
hugefiver Apr 1, 2026
1e98eda
fix(chatv2): append final-turn guidance and add graduated progress aw…
hugefiver Apr 2, 2026
2983234
fix(chatv2): guide model to output final answer instead of reporting …
hugefiver Apr 2, 2026
285d0fe
fix(chatv2): merge guidance into system message to avoid API ordering…
hugefiver Apr 2, 2026
e862eb0
build(deps): bump github.com/cloudwego/eino from 0.8.5 to 0.8.6
dependabot[bot] Apr 1, 2026
adc4176
build(deps): bump golang.org/x/image from 0.38.0 to 0.39.0 (#749)
dependabot[bot] Apr 15, 2026
23ac09d
build(deps): bump github.com/mark3labs/mcp-go from 0.46.0 to 0.48.0 (…
dependabot[bot] Apr 15, 2026
847cb5e
build(deps): bump github.com/cloudwego/eino from 0.8.6 to 0.8.9 (#752)
dependabot[bot] Apr 15, 2026
fe38945
build(deps): bump github.com/cloudwego/eino-ext/components/model/open…
dependabot[bot] Apr 15, 2026
50a467f
fix reasoning json
icceey Apr 15, 2026
9570365
build(deps): bump github.com/swaggest/openapi-go from 0.2.60 to 0.2.6…
dependabot[bot] Apr 16, 2026
55a7447
build(deps): bump github.com/cloudwego/eino-ext/components/model/open…
dependabot[bot] Apr 17, 2026
ab05b7d
build(deps): bump github.com/cloudwego/eino from 0.8.9 to 0.8.10 (#755)
dependabot[bot] Apr 18, 2026
f4165fd
build(deps): bump github.com/meilisearch/meilisearch-go (#750)
dependabot[bot] Apr 18, 2026
4889a1e
refactor(chatv2): replace react.Agent with custom tool-calling loop
hugefiver Apr 21, 2026
df1ff90
fix(chatv2): satisfy golangci-lint (err113, exhaustive)
hugefiver Apr 21, 2026
9649fb4
refactor(chatv2): separate progress channel from final answer
hugefiver Apr 21, 2026
37b9d36
go: upgrade to 1.26
icceey Apr 18, 2026
26a20f3
fix(chatv2): include progress message in streaming and non-streaming …
icceey Apr 26, 2026
3f9a608
refactor: remove AI response regeneration
icceey Apr 26, 2026
b02fbdc
feat(chatv2): implement stream output clearing mechanism and correspo…
icceey Apr 26, 2026
29ae8cc
feat: add bot status reporting to /info
icceey Apr 26, 2026
c4fa12e
fix(chatv2): preserve final response consistency
hugefiver Apr 28, 2026
29fa136
test(chatv2): cover agent output consistency
hugefiver Apr 28, 2026
120d52f
feat(chatv2): add structured progress steps
hugefiver Apr 28, 2026
c24d175
test(chatv2): cover structured progress updates
hugefiver Apr 28, 2026
6cfa2e2
fix(chatv2): preserve structured progress display
hugefiver Apr 28, 2026
8da7d93
refactor(chatv2): satisfy lint constants
hugefiver Apr 28, 2026
9808cb6
test(chatv2): clean up test contexts
hugefiver Apr 28, 2026
5b64955
build(deps): bump github.com/mark3labs/mcp-go from 0.48.0 to 0.49.0
dependabot[bot] Apr 22, 2026
0081f4e
build(deps): bump github.com/cloudwego/eino from 0.8.10 to 0.8.11
dependabot[bot] Apr 22, 2026
8e35fc0
build(deps): bump github.com/puzpuzpuz/xsync/v4 from 4.4.0 to 4.5.0
dependabot[bot] Apr 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ^1.25
go-version: ^1.26

- name: Install Go dependencies
run: make deps
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/go-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ^1.25
go-version: ^1.26

- name: Get deps
run: make deps
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ^1.25
go-version: ^1.26

- name: golangci-lint
uses: golangci/golangci-lint-action@v8
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ^1.25
go-version: ^1.26

- name: Get deps
run: make deps
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@
# CMake
cmake-build-*/

.gocache/
.golangci-lint-cache/
.gomodcache/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

Expand Down Expand Up @@ -132,4 +136,4 @@ dictionary.txt
/logs

# 自定义配置文件,避免意外提交敏感信息
custom.yaml
custom.yaml
2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "2"
run:
concurrency: 16
go: "1.25"
go: "1.26"
issues-exit-code: 1
tests: true
allow-parallel-runners: true
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: go
go: "1.25"
go: "1.26"
scripts:
- make build
- echo "Test Complete"
2 changes: 1 addition & 1 deletion .github/copilot-instructions.md → AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This repo is a modern Telegram bot for CSUST built with Go 1.25+, featuring AI chat, message search (MeiliSearch), image generation (Stable Diffusion), gacha systems, and comprehensive permission controls.
This repo is a modern Telegram bot for CSUST built with Go 1.26+, featuring AI chat, message search (MeiliSearch), image generation (Stable Diffusion), gacha systems, and comprehensive permission controls.

## Architecture Overview

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# build
FROM --platform=$BUILDPLATFORM golang:1.25-alpine AS buildenv
FROM --platform=$BUILDPLATFORM golang:1.26-alpine AS buildenv
ARG TARGETARCH

RUN apk add make git tzdata
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ A modern Telegram bot for CSUST, developed in Go.

## System Requirements

- Go 1.25+
- Go 1.26+
- Redis
- Docker & Docker Compose (recommended)

Expand Down Expand Up @@ -180,7 +180,7 @@ setiwant - f=<format> vf=<format> sf=<format> Set sticker format

## Tech Stack

- **Language**: Go 1.25+
- **Language**: Go 1.26+
- **Framework**: [telebot.v3](https://github.com/tucnak/telebot)
- **Database**: Redis
- **Search**: MeiliSearch
Expand Down
4 changes: 2 additions & 2 deletions README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

## 系统要求

- Go 1.25+
- Go 1.26+
- Redis
- Docker & Docker Compose(推荐)

Expand Down Expand Up @@ -180,7 +180,7 @@ setiwant - f=<format> vf=<format> sf=<format> 设置我要Sticker

## 技术栈

- **语言**: Go 1.25+
- **语言**: Go 1.26+
- **框架**: [telebot.v3](https://github.com/tucnak/telebot)
- **数据库**: Redis
- **搜索**: MeiliSearch
Expand Down
2 changes: 1 addition & 1 deletion base/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func Decode(ctx tb.Context) error {

result = fmt.Sprintf("```%s```", escapeMdReservedChars(result))

util.SendReply(ctx.Chat(), result, ctx.Message(), tb.ModeMarkdownV2)
util.SendReply(ctx.Chat(), util.RawTgText(result), ctx.Message(), tb.ModeMarkdownV2)

return nil
}
Expand Down
3 changes: 2 additions & 1 deletion base/get_voice.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"csust-got/config"
"csust-got/entities"
"csust-got/log"
"csust-got/util"
"encoding/json"
"errors"
"fmt"
Expand Down Expand Up @@ -553,7 +554,7 @@ func handleVoiceError(ctx tb.Context, err error, indexName string) error {
log.Error("failed to send error audio", zap.Error(sendErr))
}
} else {
if sendErr := ctx.Send(errorCaption, &tb.SendOptions{ParseMode: tb.ModeHTML}); sendErr != nil {
if _, sendErr := util.SendWithError(ctx, util.RawTgText(errorCaption), &tb.SendOptions{ParseMode: tb.ModeHTML}); sendErr != nil {
log.Error("failed to send error message", zap.Error(sendErr))
}
}
Expand Down
53 changes: 52 additions & 1 deletion base/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"time"

"csust-got/config"
"csust-got/orm"
"csust-got/util"

. "gopkg.in/telebot.v3"
Expand Down Expand Up @@ -37,9 +38,59 @@ func Info(ctx Context) error {
if config.BotConfig.DebugMode {
msg += "Debug Mode: YES\n"
}
msg += "\n"
msg += currentBotStatus(ctx)
msg += "```"

return ctx.Send(msg, ModeMarkdownV2)
_, err := util.SendWithError(ctx, util.RawTgText(msg), ModeMarkdownV2)
return err
}

func currentBotStatus(ctx Context) string {
chat := ctx.Chat()
if chat == nil {
return formatBotStatus(false, false, false, false)
}

isShutdown := orm.IsShutdown(chat.ID)
isMcDead := false
isNoSticker := false
if chat.Type == ChatGroup || chat.Type == ChatSuperGroup {
isMcDead, _ = orm.IsMcDead(chat.ID)
isNoSticker = orm.IsNoStickerMode(chat.ID)
}
isByeWorld := false
if sender := ctx.Sender(); sender != nil {
_, isByeWorld, _ = orm.IsByeWorld(chat.ID, sender.ID)
}

return formatBotStatus(isShutdown, isMcDead, isNoSticker, isByeWorld)
}

func formatBotStatus(isShutdown bool, isMcDead bool, isNoSticker bool, isByeWorld bool) string {
msg := "----- Bot Status -----\n"
if isShutdown {
msg += "Health: 因shutdown命令关机\n"
msg += "Recover: 使用/boot命令开机\n"
return msg
}
if isMcDead {
msg += "Health: 因mc命令死亡\n"
msg += "Recover: 使用/reburn命令复活\n"
return msg
}
if isNoSticker {
msg += "Health: 因no_sticker命令禁用贴纸\n"
msg += "Recover: 使用/no_sticker命令关闭禁贴纸\n"
return msg
}
if isByeWorld {
msg += "Health: 因bye_world命令自动删除你的消息\n"
msg += "Recover: 使用/hello_world命令关闭自动删除\n"
return msg
}
msg += "Health: OK\n"
return msg
}

// GetUserID is handle for command `/id`.
Expand Down
10 changes: 7 additions & 3 deletions base/hitokoto.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"csust-got/entities"
"csust-got/log"
"csust-got/orm"
"csust-got/util"

"go.uber.org/zap"
. "gopkg.in/telebot.v3"
Expand Down Expand Up @@ -100,17 +101,20 @@ func parseAPI(ctx Context) HitokotoArg {

// Hitokoto is command `hitokoto`.
func Hitokoto(ctx Context) error {
return ctx.Reply(GetHitokoto(parseAPI(ctx), true), ModeHTML)
_, err := util.ReplyWithError(ctx, util.RawTgText(GetHitokoto(parseAPI(ctx), true)), ModeHTML)
return err
}

// HitDawu is command alias `hitokoto -i`.
func HitDawu(ctx Context) error {
return ctx.Reply(GetHitokoto("i", true), ModeHTML)
_, err := util.ReplyWithError(ctx, util.RawTgText(GetHitokoto("i", true)), ModeHTML)
return err
}

// HitoNetease is command alias `hitokoto -j`.
func HitoNetease(ctx Context) error {
return ctx.Reply(GetHitokoto("j", true), ModeHTML)
_, err := util.ReplyWithError(ctx, util.RawTgText(GetHitokoto("j", true)), ModeHTML)
return err
}

// GetHitokoto can get a hitokoto.
Expand Down
4 changes: 3 additions & 1 deletion base/mc.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"csust-got/config"
"csust-got/log"
"csust-got/orm"
"csust-got/util"
"csust-got/util/restrict"

"go.uber.org/zap"
Expand Down Expand Up @@ -208,6 +209,7 @@ func Reburn(ctx tb.Context) error {
if len(missingUsers) > 0 {
log.Info("reburn missing users", zap.Int64("chat", chatID), zap.Int64s("users", missingUsers))
}
return ctx.Send(strings.Join(append(replyText, replyText2...), "\n"),
_, err = util.SendWithError(ctx, util.RawTgText(strings.Join(append(replyText, replyText2...), "\n")),
&tb.SendOptions{ParseMode: tb.ModeHTML})
return err
}
4 changes: 3 additions & 1 deletion base/search-engines.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"csust-got/config"
"csust-got/entities"
"csust-got/log"
"csust-got/util"

"go.uber.org/zap"
. "gopkg.in/telebot.v3"
Expand All @@ -17,7 +18,8 @@ type htmlMapper func(m *Message) string

func mapToHTML(mapper htmlMapper) func(Context) error {
return func(ctx Context) error {
return ctx.Reply(mapper(ctx.Message()), ModeHTML, NoPreview)
_, err := util.ReplyWithError(ctx, util.RawTgText(mapper(ctx.Message())), ModeHTML, NoPreview)
return err
}
}

Expand Down
11 changes: 7 additions & 4 deletions base/sticker.go
Original file line number Diff line number Diff line change
Expand Up @@ -916,10 +916,13 @@ func SetStickerConfig(ctx tb.Context) error {
_ = ctx.Reply("failed to marshal iwant config")
return err
}
return ctx.Reply(
fmt.Sprintf("iwant config: ```\n%s```",
util.EscapeTgMDv2ReservedChars(string(cs))),
&tb.SendOptions{ParseMode: tb.ModeMarkdownV2})
_, err = util.ReplyWithError(
ctx,
util.RawTgText(fmt.Sprintf("iwant config: ```\n%s```",
util.EscapeTgMDv2ReservedChars(string(cs)))),
&tb.SendOptions{ParseMode: tb.ModeMarkdownV2},
)
return err
}

ok, k, v := normalizeParams(k, v)
Expand Down
5 changes: 3 additions & 2 deletions base/time_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func runTimerTask(task *store.Task) {
hint = fmt.Sprintf("@%s, %s", user.Username, hint)
}

_, err = bot.Send(chat, hint, ModeHTML)
_, err = util.SendMessageWithError(chat, util.RawTgText(hint), ModeHTML)
if err != nil {
log.Error("Run Task send msg failed", zap.Any("task", task), zap.Error(err))
}
Expand Down Expand Up @@ -101,5 +101,6 @@ func RunTask(ctx Context) error {
})

text = fmt.Sprintf("好的, 在 %v 后我会来叫你…… <code>%s</code> , 嗯, 不愧是我。", delay, html.EscapeString(info))
return ctx.Reply(text, ModeHTML)
_, err = util.ReplyWithError(ctx, util.RawTgText(text), ModeHTML)
return err
}
2 changes: 1 addition & 1 deletion chat/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ final:
case v2.PlaceHolder != "":
// 如果有place_holder,先发送placeholder消息
var placeHolderErr error
placeholderMsg, placeHolderErr = ctx.Bot().Reply(ctx.Message(), v2.PlaceHolder, tb.ModeMarkdownV2)
placeholderMsg, placeHolderErr = util.SendReplyWithError(ctx.Chat(), v2.PlaceHolder, ctx.Message(), tb.ModeMarkdownV2)
Comment thread
icceey marked this conversation as resolved.
if placeHolderErr != nil {
log.Error("Failed to send placeholder message", zap.Error(placeHolderErr))
// 如果发送placeholder失败,继续正常流程,不使用placeholder功能
Expand Down
Loading
Loading