-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f0a17dc
commit d08e9e4
Showing
3 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import plugin from '../../../../lib/plugins/plugin.js' | ||
|
||
/** | ||
* 示例后处理器。你可以在example下面写一个新的。默认会调用所有此key的处理器 | ||
*/ | ||
export class ChatGPTResponsePostHandler extends plugin { | ||
constructor () { | ||
super({ | ||
name: 'chatgpt文本回复后处理器', | ||
priority: 999999, | ||
namespace: 'chatgpt-plugin', | ||
handler: [{ | ||
key: 'chatgpt.response.post', // key必须是chatgpt.response.post | ||
fn: 'postHandler' | ||
}] | ||
}) | ||
} | ||
|
||
async postHandler (e, options, reject) { | ||
const { content, use, prompt } = options | ||
// 你可以在这里处理返回的文本,比如使用自定义的语音api来合成语音 | ||
// const audio = customTTS(content) | ||
// e.reply(segment.audio(audio)) | ||
// 返回值会被忽略 | ||
} | ||
} |