feat: add target model to messages so we dont have to peek into child ai message responses every time to know what model the user sent their message to for tokenValue computations
This commit is contained in:
@@ -233,6 +233,7 @@ class BaseClient {
|
||||
sender: 'User',
|
||||
text,
|
||||
isCreatedByUser: true,
|
||||
targetModel: this.modelOptions?.model ?? this.model,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,7 @@ async function saveUserMessage(req, params) {
|
||||
parentMessageId: params.parentMessageId ?? Constants.NO_PARENT,
|
||||
/* For messages, use the assistant_id instead of model */
|
||||
model: params.assistant_id,
|
||||
targetModel: params.model,
|
||||
thread_id: params.thread_id,
|
||||
sender: 'User',
|
||||
text: params.text,
|
||||
|
||||
@@ -518,6 +518,7 @@ export const tMessageSchema = z.object({
|
||||
overrideParentMessageId: z.string().nullable().optional(),
|
||||
bg: z.string().nullable().optional(),
|
||||
model: z.string().nullable().optional(),
|
||||
targetModel: z.string().nullable().optional(),
|
||||
title: z.string().nullable().or(z.literal('New Chat')).default('New Chat'),
|
||||
sender: z.string().optional(),
|
||||
text: z.string(),
|
||||
|
||||
@@ -26,6 +26,10 @@ const messageSchema: Schema<IMessage> = new Schema(
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
targetModel: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
endpoint: {
|
||||
type: String,
|
||||
},
|
||||
|
||||
@@ -7,6 +7,7 @@ export interface IMessage extends Document {
|
||||
conversationId: string;
|
||||
user: string;
|
||||
model?: string;
|
||||
targetModel?: string;
|
||||
endpoint?: string;
|
||||
conversationSignature?: string;
|
||||
clientId?: string;
|
||||
|
||||
Reference in New Issue
Block a user