mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-16 13:27:08 +00:00
feat: init v3
This commit is contained in:
parent
d6cb085c40
commit
531986b2dc
284 changed files with 618 additions and 405179 deletions
28
models/chaite/cloud.js
Normal file
28
models/chaite/cloud.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import { DefaultToolCloudService, ToolManager } from 'chaite'
|
||||
import ChatGPTConfig from '../../config/config.js'
|
||||
import { createToolsSettingsStorage } from './tool_settings_storage.js'
|
||||
const ChatGPTToolCloudService = new DefaultToolCloudService(ChatGPTConfig.cloudBaseUrl, '', {})
|
||||
/**
|
||||
* @type {import('chaite').ToolManager}
|
||||
*/
|
||||
let ChatGPTToolManager
|
||||
ToolManager.getInstance(ChatGPTConfig.toolsDirPath, createToolsSettingsStorage(), ChatGPTToolCloudService).then((manager) => {
|
||||
ChatGPTToolManager = manager
|
||||
})
|
||||
|
||||
/**
|
||||
* 认证,以便共享上传
|
||||
* @param apiKey
|
||||
* @returns {Promise<import('chaite').User>}
|
||||
*/
|
||||
export async function authCloud (apiKey) {
|
||||
const user = await ChatGPTToolCloudService.authenticate(apiKey)
|
||||
ChatGPTToolManager.setCloudService(ChatGPTToolCloudService)
|
||||
return user
|
||||
}
|
||||
|
||||
export default {
|
||||
ChatGPTToolCloudService,
|
||||
ChatGPTToolManager
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue