-
Notifications
You must be signed in to change notification settings - Fork 2k
add new plugin aiimage and summary of the group chat
#1187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
fumiama
merged 15 commits into
FloatTech:master
from
guohuiyuan:feature-aichat-20250730
Aug 22, 2025
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
8d2dffb
✨ 添加重置聊天
guohuiyuan 8feca47
🎨 优化使用提示
guohuiyuan e5a7c30
✨ 添加群聊摘要
guohuiyuan eae8383
🐛 修复读配置bug
guohuiyuan 3eadcc3
🐛 修改wordcount的问题
guohuiyuan 9e98b8f
🐛 修复查询水群bug
guohuiyuan c72a5d2
🎨 热词限制当前群聊
guohuiyuan 0ec6480
🎨 token消耗大,添加admin权限
guohuiyuan c690405
🎨 转发分段
guohuiyuan 307f66f
✨ 添加ai画图
guohuiyuan 334363c
🎨 readme添加ai画图
guohuiyuan 958be34
✨ 添加校验
guohuiyuan bd53c19
🎨 更新zbputils
guohuiyuan 8945e97
Merge branch 'FloatTech:master' into feature-aichat-20250730
guohuiyuan 2b6a08c
🎨 优化ai画图代码
guohuiyuan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| // Package aiimage 提供AI画图功能配置 | ||
| package aiimage | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "strings" | ||
| "sync" | ||
|
|
||
| sql "github.com/FloatTech/sqlite" | ||
| ) | ||
|
|
||
| // storage 管理画图配置存储 | ||
| type storage struct { | ||
| sync.RWMutex | ||
| db sql.Sqlite | ||
| } | ||
|
|
||
| // imageConfig 存储AI画图配置信息 | ||
| type imageConfig struct { | ||
| ID int64 `db:"id"` // 主键ID | ||
| APIKey string `db:"apiKey"` // API密钥 | ||
| APIURL string `db:"apiUrl"` // API地址 | ||
| ModelName string `db:"modelName"` // 画图模型名称 | ||
| } | ||
|
|
||
| // getConfig 获取当前配置 | ||
| func (sdb *storage) getConfig() imageConfig { | ||
| sdb.RLock() | ||
| defer sdb.RUnlock() | ||
| cfg := imageConfig{} | ||
| _ = sdb.db.Find("config", &cfg, "WHERE id = 1") | ||
| return cfg | ||
| } | ||
|
|
||
| // setConfig 设置AI画图配置 | ||
| func (sdb *storage) setConfig(apiKey, apiURL, modelName string) error { | ||
| sdb.Lock() | ||
| defer sdb.Unlock() | ||
| return sdb.db.Insert("config", &imageConfig{ | ||
| ID: 1, | ||
| APIKey: apiKey, | ||
| APIURL: apiURL, | ||
| ModelName: modelName, | ||
| }) | ||
| } | ||
|
|
||
| // PrintConfig 返回格式化后的配置信息 | ||
| func (sdb *storage) PrintConfig() string { | ||
| cfg := sdb.getConfig() | ||
| var builder strings.Builder | ||
| builder.WriteString("当前AI画图配置:\n") | ||
| builder.WriteString(fmt.Sprintf("• 密钥: %s\n", cfg.APIKey)) | ||
| builder.WriteString(fmt.Sprintf("• 接口地址: %s\n", cfg.APIURL)) | ||
| builder.WriteString(fmt.Sprintf("• 模型名: %s\n", cfg.ModelName)) | ||
| return builder.String() | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.