fix: agent icons/labels for messages

This commit is contained in:
Danny Avila 2024-09-03 12:57:44 -04:00
parent 2150c4815d
commit 9a9f993f32
No known key found for this signature in database
GPG key ID: 2DD9CC89B9B50364
4 changed files with 57 additions and 7 deletions

View file

@ -2,6 +2,7 @@ const crypto = require('crypto');
const fetch = require('node-fetch');
const {
supportsBalanceCheck,
isAgentsEndpoint,
ErrorTypes,
Constants,
CacheKeys,
@ -66,6 +67,17 @@ class BaseClient {
throw new Error('Subclasses attempted to call summarizeMessages without implementing it');
}
/**
* @returns {string}
*/
getResponseModel() {
if (this.options.agent.id && isAgentsEndpoint(this.options.endpoint)) {
return this.options.agent.id;
}
return this.modelOptions.model;
}
/**
* Abstract method to get the token count for a message. Subclasses must implement this method.
* @param {TMessage} responseMessage
@ -558,7 +570,7 @@ class BaseClient {
parentMessageId: userMessage.messageId,
isCreatedByUser: false,
isEdited,
model: this.modelOptions.model,
model: this.getResponseModel(),
sender: this.sender,
promptTokens,
iconURL: this.options.iconURL,