feat: init v3

This commit is contained in:
ikechan8370 2025-03-05 23:56:41 +08:00
parent d6cb085c40
commit 531986b2dc
284 changed files with 618 additions and 405179 deletions

28
models/chaite/cloud.js Normal file
View 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
}