mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-22 20:37:48 +00:00
V4.8.17 feature (#3493)
* split tokens into input and output (#3477) * split tokens into input and output * query extension & tool call & question guide * fix * perf: input and output tokens * perf: tool call if else * perf: remove code * fix: extract usage count * fix: qa usage count --------- Co-authored-by: heheer <heheer@sealos.io>
This commit is contained in:
23
packages/global/core/ai/model.d.ts
vendored
23
packages/global/core/ai/model.d.ts
vendored
@@ -1,6 +1,13 @@
|
||||
import type { ModelProviderIdType } from './provider';
|
||||
|
||||
export type LLMModelItemType = {
|
||||
type PriceType = {
|
||||
charsPointsPrice?: number; // 1k chars=n points; 60s=n points;
|
||||
|
||||
// If inputPrice is set, the input-output charging scheme is adopted
|
||||
inputPrice?: number; // 1k tokens=n points
|
||||
outputPrice?: number; // 1k tokens=n points
|
||||
};
|
||||
export type LLMModelItemType = PriceType & {
|
||||
provider: ModelProviderIdType;
|
||||
model: string;
|
||||
name: string;
|
||||
@@ -10,8 +17,6 @@ export type LLMModelItemType = {
|
||||
quoteMaxToken: number;
|
||||
maxTemperature: number;
|
||||
|
||||
charsPointsPrice: number; // 1k chars=n points
|
||||
|
||||
censor?: boolean;
|
||||
vision?: boolean;
|
||||
|
||||
@@ -33,13 +38,12 @@ export type LLMModelItemType = {
|
||||
fieldMap?: Record<string, string>;
|
||||
};
|
||||
|
||||
export type VectorModelItemType = {
|
||||
export type VectorModelItemType = PriceType & {
|
||||
provider: ModelProviderIdType;
|
||||
model: string; // model name
|
||||
name: string; // show name
|
||||
avatar?: string;
|
||||
defaultToken: number; // split text default token
|
||||
charsPointsPrice: number; // 1k tokens=n points
|
||||
maxToken: number; // model max token
|
||||
weight: number; // training weight
|
||||
hidden?: boolean; // Disallow creation
|
||||
@@ -48,25 +52,22 @@ export type VectorModelItemType = {
|
||||
queryConfig?: Record<string, any>; // Custom parameters for query
|
||||
};
|
||||
|
||||
export type ReRankModelItemType = {
|
||||
export type ReRankModelItemType = PriceType & {
|
||||
model: string;
|
||||
name: string;
|
||||
charsPointsPrice: number;
|
||||
requestUrl: string;
|
||||
requestAuth: string;
|
||||
};
|
||||
|
||||
export type AudioSpeechModelType = {
|
||||
export type AudioSpeechModelType = PriceType & {
|
||||
provider: ModelProviderIdType;
|
||||
model: string;
|
||||
name: string;
|
||||
charsPointsPrice: number;
|
||||
voices: { label: string; value: string; bufferId: string }[];
|
||||
};
|
||||
|
||||
export type STTModelType = {
|
||||
export type STTModelType = PriceType & {
|
||||
provider: ModelProviderIdType;
|
||||
model: string;
|
||||
name: string;
|
||||
charsPointsPrice: number; // 60s = n points
|
||||
};
|
||||
|
@@ -107,7 +107,9 @@ export type DispatchNodeResponseType = {
|
||||
mergeSignId?: string;
|
||||
|
||||
// bill
|
||||
tokens?: number;
|
||||
tokens?: number; // deprecated
|
||||
inputTokens?: number;
|
||||
outputTokens?: number;
|
||||
model?: string;
|
||||
contextTotalLen?: number;
|
||||
totalPoints?: number;
|
||||
@@ -157,6 +159,8 @@ export type DispatchNodeResponseType = {
|
||||
|
||||
// tool
|
||||
toolCallTokens?: number;
|
||||
toolCallInputTokens?: number;
|
||||
toolCallOutputTokens?: number;
|
||||
toolDetail?: ChatHistoryItemResType[];
|
||||
toolStop?: boolean;
|
||||
|
||||
|
@@ -23,7 +23,8 @@ export type BillSchemaType = {
|
||||
};
|
||||
|
||||
export type ChatNodeUsageType = {
|
||||
tokens?: number;
|
||||
inputTokens?: number;
|
||||
outputTokens?: number;
|
||||
totalPoints: number;
|
||||
moduleName: string;
|
||||
model?: string;
|
||||
|
@@ -2,9 +2,13 @@ import { CreateUsageProps } from './api';
|
||||
import { UsageSourceEnum } from './constants';
|
||||
|
||||
export type UsageListItemCountType = {
|
||||
tokens?: number;
|
||||
inputTokens?: number;
|
||||
outputTokens?: number;
|
||||
charsLength?: number;
|
||||
duration?: number;
|
||||
|
||||
// deprecated
|
||||
tokens?: number;
|
||||
};
|
||||
export type UsageListItemType = UsageListItemCountType & {
|
||||
moduleName: string;
|
||||
|
Reference in New Issue
Block a user