fix: 实现Gemini客户端取代官方版本

This commit is contained in:
ikechan8370 2023-12-15 00:41:42 +08:00
parent 6769e9d3f0
commit bbe769f1aa
9 changed files with 431 additions and 2428 deletions

View file

@ -14,6 +14,9 @@ export class BaseClient {
constructor (props = {}) {
this.supportFunction = false
this.maxToken = 4096
/**
* @type {Array<AbstractTool>}
*/
this.tools = []
const {
e, getMessageById, upsertMessage, deleteMessageById, userId
@ -38,7 +41,6 @@ export class BaseClient {
* insert or update a message with the id
*
* @type function
* @param {string} id
* @param {object} message
* @return {Promise<void>}
*/
@ -90,14 +92,18 @@ export class BaseClient {
throw new Error('not implemented in abstract client')
}
addTools (...tools) {
/**
* 增加tools
* @param {[AbstractTool]} tools
*/
addTools (tools) {
if (!this.isSupportFunction) {
throw new Error('function not supported')
}
if (!this.tools) {
this.tools = []
}
this.tools.push(tools)
this.tools.push(...tools)
}
getTools () {