mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-07 19:18:52 +01:00
refactor: swap data-service and types to use new cost table
This commit is contained in:
parent
0edfecf44a
commit
4fb9d7bdff
2 changed files with 8 additions and 9 deletions
|
|
@ -697,8 +697,10 @@ export function getMessagesByConvoId(conversationId: string): Promise<s.TMessage
|
|||
return request.get(endpoints.messages({ conversationId }));
|
||||
}
|
||||
|
||||
export function getConversationCosts(conversationId: string): Promise<t.TConversationCosts> {
|
||||
return request.get(endpoints.conversationCosts(conversationId));
|
||||
export function getModelCosts(
|
||||
modelHistory: Array<{ model: string; endpoint: string }>,
|
||||
): Promise<t.TModelCosts> {
|
||||
return request.post(endpoints.costs(), { modelHistory });
|
||||
}
|
||||
|
||||
export function getPrompt(id: string): Promise<{ prompt: t.TPrompt }> {
|
||||
|
|
|
|||
|
|
@ -655,16 +655,13 @@ export type TBalanceResponse = {
|
|||
};
|
||||
|
||||
export type TConversationCosts = {
|
||||
conversationId: string;
|
||||
totals: {
|
||||
prompt: { usd: number; tokenCount: number };
|
||||
completion: { usd: number; tokenCount: number };
|
||||
total: { usd: number; tokenCount: number };
|
||||
};
|
||||
perMessage: Array<{
|
||||
messageId: string;
|
||||
tokenType: 'prompt' | 'completion';
|
||||
tokenCount: number;
|
||||
usd: number;
|
||||
}>;
|
||||
};
|
||||
|
||||
export type TModelCosts = {
|
||||
modelCostTable: Record<string, { prompt: number; completion: number }>;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue