-
Notifications
You must be signed in to change notification settings - Fork 109
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
Showing
10 changed files
with
120 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
|
||
|
||
|
||
> 由于相关领域发展快速,迭代较多,本文档有部分过时内容,不确定的问题可以开discussion或加群问群里的大佬们哦 | ||
### 推荐的相关文档和参考资料 | ||
本README | ||
|
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,46 @@ | ||
/** | ||
* 示例后处理器。你可以在example下面写一个新的。默认会调用所有此key的处理器 | ||
*/ | ||
export class ChatGPTResponsePostHandler extends plugin { | ||
constructor () { | ||
super({ | ||
name: 'chatgpt文本回复后处理器', | ||
priority: -100, | ||
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 response = await fetch('https://api.fish.audio/v1/tts', { | ||
// method: 'POST', | ||
// headers: { | ||
// Authorization: 'Bearer + key', | ||
// 'Content-Type': 'application/json' | ||
// }, | ||
// body: JSON.stringify({ | ||
// text: content, | ||
// reference_id: '1aacaeb1b840436391b835fd5513f4c4', | ||
// format: 'mp3', | ||
// latency: 'normal' | ||
// }) | ||
// }) | ||
// | ||
// if (!response.ok) { | ||
// throw new Error(`无法从服务器获取音频数据:${response.statusText}`) | ||
// } | ||
// | ||
// const audio = await response.blob() | ||
// // to Buffer | ||
// const buffer = await audio.arrayBuffer() | ||
// e.reply(segment.record(Buffer.from(buffer))) | ||
} | ||
} |
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 |
---|---|---|
@@ -1,7 +1,6 @@ | ||
import OpenAI from 'openai'; | ||
import OpenAI from 'openai' | ||
import { BaseClient } from './BaseClient.js' | ||
|
||
export default class OpenAILikeClient extends BaseClient { | ||
|
||
|
||
} |
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