mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 05:47:11 +00:00
feat: 支持GeminiPro模型
This commit is contained in:
parent
ac0aa7d02d
commit
220525fbbd
11 changed files with 415 additions and 218 deletions
|
|
@ -16,11 +16,13 @@ export class BaseClient {
|
|||
this.maxToken = 4096
|
||||
this.tools = []
|
||||
const {
|
||||
e, getMessageById, upsertMessage
|
||||
e, getMessageById, upsertMessage, deleteMessageById, userId
|
||||
} = props
|
||||
this.e = e
|
||||
this.getMessageById = getMessageById
|
||||
this.upsertMessage = upsertMessage
|
||||
this.deleteMessageById = deleteMessageById || (() => {})
|
||||
this.userId = userId
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -42,14 +44,23 @@ export class BaseClient {
|
|||
*/
|
||||
upsertMessage
|
||||
|
||||
/**
|
||||
* delete a message with the id
|
||||
*
|
||||
* @type function
|
||||
* @param {string} id
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
deleteMessageById
|
||||
|
||||
/**
|
||||
* Send prompt message with history and return response message \
|
||||
* if function called, handled internally \
|
||||
* override this method to implement logic of sending and receiving message
|
||||
*
|
||||
* @param msg
|
||||
* @param opt other options, optional fields: [conversationId, parentMessageId], if not set, random uuid instead
|
||||
* @returns {Promise<Message>} required fields: [text, conversationId, parentMessageId, id]
|
||||
* @param {string} msg
|
||||
* @param {{conversationId: string?, parentMessageId: string?, stream: boolean?, onProgress: function?}} opt other options, optional fields: [conversationId, parentMessageId], if not set, random uuid instead
|
||||
* @returns {Promise<{text, conversationId, parentMessageId, id}>} required fields: [text, conversationId, parentMessageId, id]
|
||||
*/
|
||||
async sendMessage (msg, opt = {}) {
|
||||
throw new Error('not implemented in abstract client')
|
||||
|
|
@ -60,11 +71,12 @@ export class BaseClient {
|
|||
* override this method to implement logic of getting history
|
||||
* keyv with local file or redis recommended
|
||||
*
|
||||
* @param userId such as qq number
|
||||
* @param opt other options
|
||||
* @returns {Promise<void>}
|
||||
* @param userId optional, such as qq number
|
||||
* @param parentMessageId if blank, no history
|
||||
* @param opt optional, other options
|
||||
* @returns {Promise<object[]>}
|
||||
*/
|
||||
async getHistory (userId, opt = {}) {
|
||||
async getHistory (parentMessageId, userId = this.userId, opt = {}) {
|
||||
throw new Error('not implemented in abstract client')
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue