mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-08-02 11:40:04 +00:00
✨ 添加开发文档和 API 文档的初始结构;更新 .gitignore 以排除生成的文档目录
This commit is contained in:
28
docs/en/dev/api/util_hunyuan.md
Normal file
28
docs/en/dev/api/util_hunyuan.md
Normal file
@ -0,0 +1,28 @@
|
||||
---
|
||||
title: util_hunyuan
|
||||
---
|
||||
# **Module** `nonebot_plugin_marshoai.util_hunyuan`
|
||||
|
||||
---
|
||||
### ***func*** `generate_image(prompt: str)`
|
||||
|
||||
|
||||
<details>
|
||||
<summary> <b>Source code</b> or <a href='https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/util_hunyuan.py#L16' target='_blank'>View on GitHub</a></summary>
|
||||
|
||||
```python
|
||||
def generate_image(prompt: str):
|
||||
cred = credential.Credential(config.marshoai_tencent_secretid, config.marshoai_tencent_secretkey)
|
||||
httpProfile = HttpProfile()
|
||||
httpProfile.endpoint = 'hunyuan.tencentcloudapi.com'
|
||||
clientProfile = ClientProfile()
|
||||
clientProfile.httpProfile = httpProfile
|
||||
client = hunyuan_client.HunyuanClient(cred, 'ap-guangzhou', clientProfile)
|
||||
req = models.TextToImageLiteRequest()
|
||||
params = {'Prompt': prompt, 'RspImgType': 'url', 'Resolution': '1080:1920'}
|
||||
req.from_json_string(json.dumps(params))
|
||||
resp = client.TextToImageLite(req)
|
||||
return resp.to_json_string()
|
||||
```
|
||||
</details>
|
||||
|
Reference in New Issue
Block a user