mirror of
https://github.com/eryajf/chatgpt-dingtalk.git
synced 2026-04-22 23:47:15 +08:00
feat: 支持上传图片到钉钉平台,在图片生成流程中使用钉钉的图片 CDN 能力 (#225)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package process
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/eryajf/chatgpt-dingtalk/public"
|
||||
"strings"
|
||||
@@ -12,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
// ImageGenerate openai生成图片
|
||||
func ImageGenerate(rmsg *dingbot.ReceiveMsg) error {
|
||||
func ImageGenerate(ctx context.Context, rmsg *dingbot.ReceiveMsg) error {
|
||||
if public.Config.AzureOn {
|
||||
_, err := rmsg.ReplyToDingtalk(string(dingbot.
|
||||
MARKDOWN), "azure 模式下暂不支持图片创作功能")
|
||||
@@ -32,7 +33,7 @@ func ImageGenerate(rmsg *dingbot.ReceiveMsg) error {
|
||||
if err != nil {
|
||||
logger.Error("往MySQL新增数据失败,错误信息:", err)
|
||||
}
|
||||
reply, err := chatgpt.ImageQa(rmsg.Text.Content, rmsg.GetSenderIdentifier())
|
||||
reply, err := chatgpt.ImageQa(ctx, rmsg.Text.Content, rmsg.GetSenderIdentifier())
|
||||
if err != nil {
|
||||
logger.Info(fmt.Errorf("gpt request error: %v", err))
|
||||
_, err = rmsg.ReplyToDingtalk(string(dingbot.TEXT), fmt.Sprintf("请求openai失败了,错误信息:%v", err))
|
||||
|
||||
Reference in New Issue
Block a user