mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-08-01 03:59:51 +00:00
把回复消息中的 图片 全部插入消息体;
Black格式化代码
This commit is contained in:
@ -3,11 +3,17 @@ import types
|
||||
from tencentcloud.common import credential
|
||||
from tencentcloud.common.profile.client_profile import ClientProfile
|
||||
from tencentcloud.common.profile.http_profile import HttpProfile
|
||||
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
|
||||
from tencentcloud.common.exception.tencent_cloud_sdk_exception import (
|
||||
TencentCloudSDKException,
|
||||
)
|
||||
from tencentcloud.hunyuan.v20230901 import hunyuan_client, models
|
||||
from .config import config
|
||||
|
||||
|
||||
def generate_image(prompt: str):
|
||||
cred = credential.Credential(config.marshoai_tencent_secretid, config.marshoai_tencent_secretkey)
|
||||
cred = credential.Credential(
|
||||
config.marshoai_tencent_secretid, config.marshoai_tencent_secretkey
|
||||
)
|
||||
# 实例化一个http选项,可选的,没有特殊需求可以跳过
|
||||
httpProfile = HttpProfile()
|
||||
httpProfile.endpoint = "hunyuan.tencentcloudapi.com"
|
||||
@ -18,11 +24,7 @@ def generate_image(prompt: str):
|
||||
client = hunyuan_client.HunyuanClient(cred, "ap-guangzhou", clientProfile)
|
||||
|
||||
req = models.TextToImageLiteRequest()
|
||||
params = {
|
||||
"Prompt": prompt,
|
||||
"RspImgType": "url",
|
||||
"Resolution": "1080:1920"
|
||||
}
|
||||
params = {"Prompt": prompt, "RspImgType": "url", "Resolution": "1080:1920"}
|
||||
req.from_json_string(json.dumps(params))
|
||||
|
||||
# 返回的resp是一个TextToImageLiteResponse的实例,与请求对象对应
|
||||
|
Reference in New Issue
Block a user