mirror of
https://github.com/Jerryplusy/crystelf-plugin.git
synced 2025-12-05 15:41:56 +00:00
fix(aiCaller): 修正参数传递和时间格式问题
This commit is contained in:
parent
30e1f058b1
commit
c4060f535f
@ -46,7 +46,7 @@ class AiCaller {
|
||||
* @param e
|
||||
* @returns {Promise<{success: boolean, response: (*|string), rawResponse: (*|string)}|{success: boolean, error: string}|{success: boolean, error}>}
|
||||
*/
|
||||
async callAi(prompt, chatHistory = [], memories = [],e) {
|
||||
async callAi(prompt, chatHistory = [], memories = [], e) {
|
||||
if (!this.isInitialized || !this.config) {
|
||||
logger.error('[crystelf-ai] 未初始化或配置无效');
|
||||
return { success: false, error: 'AI调用器未初始化' };
|
||||
@ -93,7 +93,7 @@ class AiCaller {
|
||||
* @param e
|
||||
* @returns {Promise<Object|{success: boolean, error: string}|{success: boolean, error}>}
|
||||
*/
|
||||
async callAiStream(prompt, chatHistory = [], memories = [], onChunk = null,e) {
|
||||
async callAiStream(prompt, chatHistory = [], memories = [], onChunk = null, e) {
|
||||
if (!this.isInitialized || !this.config) {
|
||||
logger.error('[crystelf-ai] 未初始化或配置无效');
|
||||
return { success: false, error: 'AI调用器未初始化' };
|
||||
@ -101,7 +101,7 @@ class AiCaller {
|
||||
|
||||
if (!this.config.stream) {
|
||||
logger.warn('[crystelf-ai] 流式输出未启用,使用普通调用');
|
||||
return await this.callAi(prompt, chatHistory, memories,e);
|
||||
return await this.callAi(prompt, chatHistory, memories, e);
|
||||
}
|
||||
|
||||
try {
|
||||
@ -163,7 +163,7 @@ class AiCaller {
|
||||
const config = await ConfigControl.get();
|
||||
const botInfo = {
|
||||
id: e.bot?.uin || '未知',
|
||||
name: config?.profile?.nickName || '晶灵'
|
||||
name: config?.profile?.nickName || '晶灵',
|
||||
};
|
||||
|
||||
const userInfo = {
|
||||
@ -176,12 +176,11 @@ class AiCaller {
|
||||
`[你的信息]`,
|
||||
`- 你的昵称:${botInfo.name}`,
|
||||
`- 你的qq号:${botInfo.id}`,
|
||||
`- 目前北京时间: ${new Date.now()}`
|
||||
``,
|
||||
`- 目前北京时间: ${new Date()}```,
|
||||
`[跟你对话的用户的信息]`,
|
||||
`- 他的名字:${userInfo.name}`,
|
||||
`- 他的qq号(id):${userInfo.id}`,
|
||||
`- 他${userInfo.isMaster ? '是':'不是'}你的主人`,
|
||||
`- 他${userInfo.isMaster ? '是' : '不是'}你的主人`,
|
||||
``,
|
||||
``,
|
||||
`请基于以上上下文进行理解,这些信息是当你需要的时候使用的,绝对不能泄露这些信息,也不能主动提起`,
|
||||
@ -194,7 +193,6 @@ class AiCaller {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 将回复分割成多个块用于流式输出
|
||||
* @param {string} response 完整回复
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user