mirror of
https://github.com/Jerryplusy/crystelf-plugin.git
synced 2026-01-29 09:17:27 +00:00
Compare commits
No commits in common. "9a642aa5606e171c8a09643cb09a049bb4787d76" and "943a51be652823cd6fcded0c125ca893952b05fb" have entirely different histories.
9a642aa560
...
943a51be65
30
README.md
30
README.md
@ -118,7 +118,7 @@
|
|||||||
- [X] 获取引用消息
|
- [X] 获取引用消息
|
||||||
- [X] 适配多模态模型,查看图片等
|
- [X] 适配多模态模型,查看图片等
|
||||||
- [ ] 支持联网搜索
|
- [ ] 支持联网搜索
|
||||||
- [X] 支持生成图片
|
- [ ] 支持生成图片
|
||||||
- [ ] 支持渲染数学公式
|
- [ ] 支持渲染数学公式
|
||||||
- [ ] 违禁词检测
|
- [ ] 违禁词检测
|
||||||
- [ ] 使用toon代替json与模型交互
|
- [ ] 使用toon代替json与模型交互
|
||||||
@ -301,34 +301,6 @@
|
|||||||
"fontSize": 14,
|
"fontSize": 14,
|
||||||
"codeTheme": "github"
|
"codeTheme": "github"
|
||||||
},
|
},
|
||||||
|
|
||||||
"?imageConfig": "图像生成配置",
|
|
||||||
"imageConfig": {
|
|
||||||
"?enabled": "是否启用图像生成功能",
|
|
||||||
"enabled": true,
|
|
||||||
"?imageMode": "图像生成模式: 'openai'使用/v1/images/generations接口, 'chat'使用对话式生图模型(如gemini-3-pro-image-preview)",
|
|
||||||
"imageMode": "openai",
|
|
||||||
"?model": "图像生成模型名称(支持gemini-3-pro-image-preview等)",
|
|
||||||
"model": "gemini-3-pro-image-preview",
|
|
||||||
"?baseApi": "图像生成API基础地址(不加v1后面的)",
|
|
||||||
"baseApi": "https://api.uniapi.io",
|
|
||||||
"?apiKey": "图像生成API密钥",
|
|
||||||
"apiKey": "",
|
|
||||||
"?timeout": "图像生成超时时间(豪秒)",
|
|
||||||
"timeout": 60000,
|
|
||||||
"?maxRetries": "最大重试次数",
|
|
||||||
"maxRetries": 3,
|
|
||||||
"?quality": "生成图像质量(standard/high)",
|
|
||||||
"quality": "standard",
|
|
||||||
"?style": "图像风格(natural/vivid)",
|
|
||||||
"style": "natural",
|
|
||||||
"?size": "生成图像尺寸(1024x1024/1792x1024/...)",
|
|
||||||
"size": "1024x1024",
|
|
||||||
"?responseFormat": "响应格式(url/b64_json)",
|
|
||||||
"responseFormat": "url",
|
|
||||||
"?modalities": "模态类型(text/image)",
|
|
||||||
"modalities": ["text", "image"]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@ -62,32 +62,9 @@ class OpenaiChat {
|
|||||||
presence_penalty: 0.2,
|
presence_penalty: 0.2,
|
||||||
stream:false
|
stream:false
|
||||||
});
|
});
|
||||||
let parsedCompletion = completion;
|
|
||||||
if (typeof completion === 'string') {
|
const aiResponse = completion.choices[0].message.content;
|
||||||
try {
|
//logger.info(aiResponse);
|
||||||
parsedCompletion = JSON.parse(completion);
|
|
||||||
} catch (parseError) {
|
|
||||||
logger.error('[crystelf-ai] 响应JSON解析失败:', parseError);
|
|
||||||
return { success: false };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//logger.info("[DEBUG] 解析后的响应:", JSON.stringify(parsedCompletion));
|
|
||||||
let aiResponse = null;
|
|
||||||
|
|
||||||
if (parsedCompletion && parsedCompletion.choices && Array.isArray(parsedCompletion.choices) && parsedCompletion.choices.length > 0) {
|
|
||||||
const choice = parsedCompletion.choices[0];
|
|
||||||
if (choice && choice.message && choice.message.content) {
|
|
||||||
aiResponse = choice.message.content;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!aiResponse) {
|
|
||||||
logger.error('[crystelf-ai] 无法从响应中提取AI回复内容:', parsedCompletion);
|
|
||||||
return { success: false };
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.info("[DEBUG] AI响应内容:", aiResponse);
|
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
aiResponse: aiResponse,
|
aiResponse: aiResponse,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user