🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat(agent-run): add a business slot for a per-run agent fee (#22375)
YuTengjing72f308a7d36e
diff --git a/apps/server/src/services/agentRuntime/CompletionLifecycle/index.runSlot.test.ts b/apps/server/src/services/agentRuntime/CompletionLifecycle/index.runSlot.test.tsindex 9cd18a2611f..b31df2a51b8 100644--- a/apps/server/src/services/agentRuntime/CompletionLifecycle/index.runSlot.test.ts+++ b/apps/server/src/services/agentRuntime/CompletionLifecycle/index.runSlot.test.ts@@ -4,9 +4,13 @@ import { afterEach, describe, expect, it, vi } from 'vitest';import { hookDispatcher } from '../hooks';import { CompletionLifecycle } from '.';-const { releaseAgentRunSlot } = vi.hoisted(() => ({ releaseAgentRunSlot: vi.fn() }));+const { releaseAgentRunSlot, settleAgentRunFee } = vi.hoisted(() => ({+ releaseAgentRunSlot: vi.fn(),+ settleAgentRunFee: vi.fn(async () => {}),+}));vi.mock('@/business/server/agent-run/runConcurrency', () => ({ releaseAgentRunSlot }));+vi.mock('@/business/server/agent-run/runFee', () => ({ settleAgentRunFee }));vi.mock('@/database/models/work', () => import('./testUtils').then((m) => m.workModelModule()));vi.mock('@/database/models/topic', () => import('./testUtils').then((m) => m.topicModelModule()));vi.mock('@/business/server/agent-run/agentInterventionReview', () =>@@ -75,3 +79,54 @@ describe('CompletionLifecycle.dispatchHooks — concurrency slot', () => {},);});++describe('CompletionLifecycle.dispatchHooks — run fee', () => {+ afterEach(() => {+ vi.restoreAllMocks();+ settleAgentRunFee.mockReset();+ settleAgentRunFee.mockImplementation(async () => {});+ });++ it.each(['done', 'error', 'interrupted', 'waiting_for_human'])(+ 'settles the fee with the terminal reason %s',+ async (reason) => {+ await buildLifecycle().dispatchHooks(+ 'op-1',+ { ...state(reason), createdAt: new Date(Date.now() - 45_000).toISOString() },+ reason,+ { skipErrorMessageWrite: true },+ );++ expect(settleAgentRunFee).toHaveBeenCalledWith({+ durationMs: expect.any(Number),+ operationId: 'op-1',+ reason,+ userId: 'user-1',+ });+ expect(settleAgentRunFee.mock.calls[0][0].durationMs).toBeGreaterThanOrEqual(45_000);+ },+ );++ it.each(['waiting_for_async_tool', 'waiting_for_client'])(+ 'leaves the fee held while the same run is parked in %s',+ async (reason) => {+ await buildLifecycle().dispatchHooks('op-1', state(reason), reason);++ expect(settleAgentRunFee).not.toHaveBeenCalled();+ },+ );++ it('still dispatches completion hooks when settling the fee fails', async () => {+ settleAgentRunFee.mockRejectedValue(new Error('db down'));+ vi.spyOn(console, 'error').mockImplementation(() => {});++ await buildLifecycle().dispatchHooks('op-1', state('done'), 'done');++ expect(hookDispatcher.dispatch).toHaveBeenCalledWith(+ 'op-1',+ 'onComplete',+ expect.anything(),+ [],+ );+ });+});diff --git a/apps/server/src/services/agentRuntime/CompletionLifecycle/index.ts b/apps/server/src/services/agentRuntime/CompletionLifecycle/index.tsindex d2acc1f830b..4f1a88a6961 100644--- a/apps/server/src/services/agentRuntime/CompletionLifecycle/index.ts+++ b/apps/server/src/services/agentRuntime/CompletionLifecycle/index.ts@@ -1,6 +1,7 @@import debug from 'debug';import { releaseAgentRunSlot } from '@/business/server/agent-run/runConcurrency';+import { settleAgentRunFee } from '@/business/server/agent-run/runFee';import {AgentOperationModel,type RecordOperationStartParams,@@ -369,6 +370,19 @@ export class CompletionLifecycle {// too; its continuation takes a slot of its own.await releaseAgentRunSlot(runOrigin.userId || this.userId, operationId);+ // Charge or give back the per-run fee the run held at admission. A run+ // parked on a human decision settles here too: its continuation is part+ // of the same run and holds no fee of its own. A billing failure must+ // not cost the user their completion hooks.+ await settleAgentRunFee({+ durationMs: event.duration,+ operationId,+ reason,+ userId: runOrigin.userId || this.userId,+ }).catch((error) => {+ console.error('[CompletionLifecycle] settleAgentRunFee failed', { error, operationId });+ });+// `lastAssistantContent` comes off the Redis-backed `state.messages`,// while the assistant message row is persisted through a separate// `messageModel.update` path. When the two diverge (state entry emptydiff --git a/apps/server/src/services/aiAgent/index.ts b/apps/server/src/services/aiAgent/index.tsindex 0d19129a650..f9273673e5f 100644--- a/apps/server/src/services/aiAgent/index.ts+++ b/apps/server/src/services/aiAgent/index.ts@@ -75,6 +75,7 @@ import {} from './pipeline/groupMemberApproval';import { resolveNewThread } from './pipeline/newThread';import { createGroupAgentTopic, type PrecreatedTopicDeps } from './pipeline/precreatedTopic';+import { releaseUnstartedRunFee, type RunFeeClaim } from './pipeline/runFee';import { releaseUnstartedRunSlot, type RunSlotClaim } from './pipeline/runSlot';import { scheduleAgentRun } from './pipeline/scheduleAgentRun';import { runWithTopicStart, type TopicStartDeps } from './pipeline/topicStart';@@ -529,11 +530,13 @@ export class AiAgentService {};const runSlot: RunSlotClaim = {};+ const runFee: RunFeeClaim = {};try {- return await execAgentTurn(this.execAgentTurnDeps, params, approvalClaim, runSlot);+ return await execAgentTurn(this.execAgentTurnDeps, params, approvalClaim, runSlot, runFee);} finally {await releaseUnstartedRunSlot(runSlot, this.userId);+ await releaseUnstartedRunFee(runFee, this.userId);if (!approvalClaim.continuationPrepared &&!approvalClaim.continuationStarted &&diff --git a/apps/server/src/services/aiAgent/pipeline/execTurn.ts b/apps/server/src/services/aiAgent/pipeline/execTurn.tsindex d82b01d093d..935b37ba261 100644--- a/apps/server/src/services/aiAgent/pipeline/execTurn.ts+++ b/apps/server/src/services/aiAgent/pipeline/execTurn.ts@@ -35,6 +35,7 @@ import { buildOperationInitRequest, runOperationInit } from './operationInit';import { createHistoryMessagesLoader } from './operationPrep';import { resolveRunAgentConfig } from './resolveRunAgentConfig';import { loadResumeParentMessage } from './resumeParent';+import { bindRunFee, claimRunFee, type RunFeeClaim, shouldHoldRunFee } from './runFee';import { resolveRunSettings } from './runSettings';import { bindRunSlot, claimRunSlot, resolveRunSlotPolicy, type RunSlotClaim } from './runSlot';import { traceSendStage } from './sendTracing';@@ -89,6 +90,7 @@ export const execAgentTurn = async (params: InternalExecAgentParams,approvalClaim: ApprovalClaimState,runSlot: RunSlotClaim = {},+ runFee: RunFeeClaim = {},): Promise<ExecAgentResult> => {const {additionalPluginIds,@@ -291,6 +293,10 @@ export const execAgentTurn = async (policy: resolveRunSlotPolicy(params, { agentConfig, workspaceId: deps.workspaceId }),userId: deps.userId,});+ await claimRunFee(runFee, {+ hold: shouldHoldRunFee(params, { agentConfig, workspaceId: deps.workspaceId }),+ userId: deps.userId,+ });let resumeParentMessage: Awaited<ReturnType<MessageModel['findById']>>;@@ -599,6 +605,7 @@ export const execAgentTurn = async (continuationOperationId ??`op_${Date.now()}_${resolvedAgentId}_${topicId}_${nanoid(8)}`;await bindRunSlot(runSlot, deps.userId, operationId);+ await bindRunFee(runFee, deps.userId, operationId);// Stages 5–18 — the run's init: the tool surface, the message/context// assembly, and the human decision a resumed approval turns into the first@@ -748,10 +755,12 @@ export const execAgentTurn = async (approvalSourceToolMessageIds,autoStart,onOperationCreated: params.onOperationCreated,- // From here the run's completion releases the slot; a run that never- // started (failed, or created without auto-start) gives it back.+ // From here the run's completion releases the slot and settles the+ // fee; a run that never started (failed, or created without+ // auto-start) gives both back.onScheduled: () => {runSlot.handedOff = true;+ runFee.handedOff = true;},botContext,botPlatformContext,diff --git a/apps/server/src/services/aiAgent/pipeline/runFee.test.ts b/apps/server/src/services/aiAgent/pipeline/runFee.test.tsnew file mode 100644index 00000000000..dfa97ec9b3c--- /dev/null+++ b/apps/server/src/services/aiAgent/pipeline/runFee.test.ts@@ -0,0 +1,114 @@+// @vitest-environment node+import { beforeEach, describe, expect, it, vi } from 'vitest';++import type { AgentConfigWithId } from '@/server/services/agent';++import type { InternalExecAgentParams } from '../types';+import {+ bindRunFee,+ claimRunFee,+ releaseUnstartedRunFee,+ type RunFeeClaim,+ shouldHoldRunFee,+} from './runFee';++const fees = vi.hoisted(() => ({+ holdAgentRunFee: vi.fn(),+ rebindAgentRunFee: vi.fn(),+ releaseAgentRunFee: vi.fn(),+}));++vi.mock('@/business/server/agent-run/runFee', () => fees);++const agentConfig = { id: 'agt_1', model: 'gpt-4o' } as AgentConfigWithId;+const composerSend = {+ agentId: 'agt_1',+ interactiveStart: true,+ prompt: 'hi',+} as InternalExecAgentParams;++const holds = (params: Partial<InternalExecAgentParams>, workspaceId?: string) =>+ shouldHoldRunFee({ ...composerSend, ...params } as InternalExecAgentParams, {+ agentConfig,+ workspaceId,+ });++describe('shouldHoldRunFee', () => {+ it('holds a fee for every run the user starts, foreground or background', () => {+ expect(holds({})).toBe(true);+ expect(holds({ parentMessageId: 'msg_1' })).toBe(true);+ expect(holds({ interactiveStart: false })).toBe(true);+ expect(holds({ trigger: 'cron' } as any)).toBe(true);+ });++ it('holds no fee for a continuation of a run that already holds one', () => {+ expect(holds({ resume: true } as any)).toBe(false);+ expect(holds({ resumeApproval: { decision: 'approved' } as any })).toBe(false);+ expect(holds({ resumeApprovals: [{ decision: 'approved' }] as any })).toBe(false);+ expect(holds({ resumeToolResult: { toolCallId: 't' } as any })).toBe(false);+ expect(holds({ approvalResolutionRequestId: 'req_1' } as any)).toBe(false);+ expect(holds({ steer: true } as any)).toBe(false);+ });++ it('holds no fee for sub-agent, group member and Workspace runs', () => {+ expect(holds({ parentOperationId: 'op_parent' })).toBe(false);+ expect(holds({ appContext: { isSubAgent: true } as any })).toBe(false);+ expect(holds({ appContext: { orchestrationRole: 'member' } as any })).toBe(false);+ expect(holds({}, 'ws_1')).toBe(false);+ });++ it('holds no fee for external agents', () => {+ expect(+ shouldHoldRunFee(composerSend, {+ agentConfig: {+ ...agentConfig,+ agencyConfig: { heterogeneousProvider: { type: 'claude-code' } },+ } as AgentConfigWithId,+ }),+ ).toBe(false);+ });+});++describe('run fee claim', () => {+ beforeEach(() => {+ for (const fn of Object.values(fees)) fn.mockReset();+ });++ it('lets a refused hold propagate and keeps nothing to release', async () => {+ fees.holdAgentRunFee.mockRejectedValue(new Error('insufficient'));+ const claim: RunFeeClaim = {};++ await expect(claimRunFee(claim, { hold: true, userId: 'u1' })).rejects.toThrow('insufficient');+ await releaseUnstartedRunFee(claim, 'u1');++ expect(fees.releaseAgentRunFee).not.toHaveBeenCalled();+ });++ it('holds nothing when the run is exempt', async () => {+ const claim: RunFeeClaim = {};+ await claimRunFee(claim, { hold: false, userId: 'u1' });++ expect(fees.holdAgentRunFee).not.toHaveBeenCalled();+ expect(claim.holderId).toBeUndefined();+ });++ it('moves the fee to the operation and releases it when the run never started', async () => {+ const claim: RunFeeClaim = {};+ await claimRunFee(claim, { hold: true, userId: 'u1' });+ const provisional = claim.holderId;+ await bindRunFee(claim, 'u1', 'op_1');+ await releaseUnstartedRunFee(claim, 'u1');++ expect(fees.rebindAgentRunFee).toHaveBeenCalledWith('u1', provisional, 'op_1');+ expect(fees.releaseAgentRunFee).toHaveBeenCalledWith('u1', 'op_1');+ });++ it('leaves a started run’s fee to its completion', async () => {+ const claim: RunFeeClaim = {};+ await claimRunFee(claim, { hold: true, userId: 'u1' });+ claim.handedOff = true;+ await releaseUnstartedRunFee(claim, 'u1');++ expect(fees.releaseAgentRunFee).not.toHaveBeenCalled();+ });+});diff --git a/apps/server/src/services/aiAgent/pipeline/runFee.ts b/apps/server/src/services/aiAgent/pipeline/runFee.tsnew file mode 100644index 00000000000..ee8261587cd--- /dev/null+++ b/apps/server/src/services/aiAgent/pipeline/runFee.ts@@ -0,0 +1,87 @@+import { isHeterogeneousAgentModelId } from '@lobechat/const';+import { nanoid } from '@lobechat/utils';++import {+ holdAgentRunFee,+ rebindAgentRunFee,+ releaseAgentRunFee,+} from '@/business/server/agent-run/runFee';+import type { AgentConfigWithId } from '@/server/services/agent';++import type { InternalExecAgentParams } from '../types';++/**+ * Whether a run carries the per-run fee. One fee covers what the user started:+ * the run they sent, regenerated or queued, foreground or background.+ *+ * Exempt:+ * - a continuation of a run already started (approval or tool-result resume,+ * steer), which belongs to the run that held the fee;+ * - a sub-agent or group member, which is a step of its root run;+ * - Workspace runs, which bill elsewhere;+ * - an external agent (Claude Code, Codex, …), which runs on the user's device.+ */+export const shouldHoldRunFee = (+ params: InternalExecAgentParams,+ { agentConfig, workspaceId }: { agentConfig: AgentConfigWithId; workspaceId?: string },+): boolean => {+ const { appContext } = params;+ if (workspaceId) return false;+ if (+ params.parentOperationId ||+ appContext?.isSubAgent ||+ appContext?.orchestrationRole === 'member'+ )+ return false;+ if (+ agentConfig.agencyConfig?.heterogeneousProvider?.type ||+ isHeterogeneousAgentModelId(agentConfig.model)+ )+ return false;++ const continuesRun =+ !!params.resume ||+ !!params.resumeApproval ||+ !!params.resumeApprovals?.length ||+ !!params.resumeToolResult ||+ !!params.approvalResolutionRequestId ||+ !!params.steer;+ return !continuesRun;+};++/**+ * The fee one `execAgentTurn` call holds. Like the run slot, it is held before+ * the turn writes any row under a provisional id, and moved to the operation id+ * once it exists. Until the operation starts, the caller gives it back on every+ * exit; afterwards the run's completion settles it.+ */+export interface RunFeeClaim {+ /** Set once the started operation owns the fee. */+ handedOff?: boolean;+ holderId?: string;+}++/** Holds the run's fee under a provisional id. */+export const claimRunFee = async (+ claim: RunFeeClaim,+ { hold, userId }: { hold: boolean; userId: string },+): Promise<void> => {+ if (!hold) return;++ const holderId = `pending_${nanoid()}`;+ await holdAgentRunFee({ holderId, userId });+ claim.holderId = holderId;+};++/** Moves the held fee to the operation that settles it. */+export const bindRunFee = async (claim: RunFeeClaim, userId: string, operationId: string) => {+ if (!claim.holderId || claim.holderId === operationId) return;+ await rebindAgentRunFee(userId, claim.holderId, operationId);+ claim.holderId = operationId;+};++/** Gives back a fee whose operation never started. */+export const releaseUnstartedRunFee = async (claim: RunFeeClaim, userId: string) => {+ if (!claim.holderId || claim.handedOff) return;+ await releaseAgentRunFee(userId, claim.holderId);+};diff --git a/locales/en-US/spend.json b/locales/en-US/spend.jsonindex 6030f5875e4..51809d4939f 100644--- a/locales/en-US/spend.json+++ b/locales/en-US/spend.json@@ -58,6 +58,7 @@"table.columns.trigger.enums.verify": "Acceptance check","table.columns.trigger.enums.video": "Video generation","table.columns.trigger.title": "Trigger",+ "table.columns.type.enums.agentRun": "Agent task fee","table.columns.type.enums.chat": "Text generation","table.columns.type.enums.embedding": "Embedding","table.columns.type.enums.imageGeneration": "Image generation",diff --git a/locales/en-US/subscription.json b/locales/en-US/subscription.jsonindex 743d3d7f67c..ca06b045eb2 100644--- a/locales/en-US/subscription.json+++ b/locales/en-US/subscription.json@@ -486,6 +486,7 @@"plans.cloud.sync": "Global cloud sync","plans.cloud.title": "Cloud service","plans.compare.agentMemory": "Agent memory",+ "plans.compare.agentRunFee": "Fee per agent task","plans.compare.artifactSiteSize": "Max size per site","plans.compare.artifactSites": "Active Artifact sites","plans.compare.baseline": "Limits are compared as multiples of {{plan}}.",@@ -557,6 +558,8 @@"plans.legacy.upgradeOnly": "A legacy plan can only be upgraded to a higher-tier plan","plans.limits.agentMemory.unavailable": "Agent memory","plans.limits.agentMemory.unlimited": "Agent memory",+ "plans.limits.agentRunFee": "{{value}} per agent task",+ "plans.limits.agentRunFee.tooltip": "Charged from your balance when an agent task you start finishes, on top of its model usage. Tasks that fail, or that you stop within 30 seconds, are free.","plans.limits.artifactSiteSize": "Up to {{value}} per published site","plans.limits.artifactSites": "Up to {{value}} active Artifact sites","plans.limits.concurrentAgentRuns": "{{value}} agent tasks at once",diff --git a/locales/zh-CN/spend.json b/locales/zh-CN/spend.jsonindex 4e84ba0b7fa..571d32ec248 100644--- a/locales/zh-CN/spend.json+++ b/locales/zh-CN/spend.json@@ -58,6 +58,7 @@"table.columns.trigger.enums.verify": "验收","table.columns.trigger.enums.video": "视频生成","table.columns.trigger.title": "触发方式",+ "table.columns.type.enums.agentRun": "智能体任务费","table.columns.type.enums.chat": "文本生成","table.columns.type.enums.embedding": "嵌入","table.columns.type.enums.imageGeneration": "图像生成",diff --git a/locales/zh-CN/subscription.json b/locales/zh-CN/subscription.jsonindex 0a08e3dd481..26c21facb75 100644--- a/locales/zh-CN/subscription.json+++ b/locales/zh-CN/subscription.json@@ -486,6 +486,7 @@"plans.cloud.sync": "全球云端同步","plans.cloud.title": "云服务","plans.compare.agentMemory": "智能体记忆",+ "plans.compare.agentRunFee": "每个智能体任务费用","plans.compare.artifactSiteSize": "单站点大小上限","plans.compare.artifactSites": "在线 Artifact 站点数","plans.compare.baseline": "限额以 {{plan}} 为基准,按倍数对比。",@@ -557,6 +558,8 @@"plans.legacy.upgradeOnly": "旧版套餐只能升级到更高级的套餐","plans.limits.agentMemory.unavailable": "智能体记忆","plans.limits.agentMemory.unlimited": "智能体记忆",+ "plans.limits.agentRunFee": "每个智能体任务 {{value}}",+ "plans.limits.agentRunFee.tooltip": "你发起的智能体任务完成后从余额扣除,模型用量另计。失败的任务,或 30 秒内被你停止的任务不收费。","plans.limits.artifactSiteSize": "单个站点最大 {{value}}","plans.limits.artifactSites": "最多 {{value}} 个在线 Artifact 站点","plans.limits.concurrentAgentRuns": "同时运行 {{value}} 个智能体任务",diff --git a/packages/business-server/src/agent-run/runFee.ts b/packages/business-server/src/agent-run/runFee.tsnew file mode 100644index 00000000000..1bd39ef98e9--- /dev/null+++ b/packages/business-server/src/agent-run/runFee.ts@@ -0,0 +1,40 @@+export interface HoldAgentRunFeeParams {+ /** The run's operation id, or a provisional id later moved with {@link rebindAgentRunFee}. */+ holderId: string;+ userId: string;+}++export interface SettleAgentRunFeeParams {+ /** How long the run took, from its start to this terminal state. */+ durationMs?: number;+ operationId: string;+ /** The terminal reason the run ended with (`done`, `error`, `interrupted`, …). */+ reason: string;+ userId: string;+}++/**+ * A fee for each agent run a user starts, held when the run is admitted and+ * settled when it ends. The default never charges; a deployment that bills+ * runs overrides these four functions.+ *+ * Hold runs before the turn writes any row. It should not refuse the run: a+ * deployment that does throws, and the message then stays in the composer.+ */+export const holdAgentRunFee = async (_params: HoldAgentRunFeeParams): Promise<void> => {};++/** Moves a fee held under a provisional id to the operation id that owns it. */+export const rebindAgentRunFee = async (+ _userId: string,+ _fromHolderId: string,+ _toHolderId: string,+): Promise<void> => {};++/** Gives back the fee of a run that never started. */+export const releaseAgentRunFee = async (_userId: string, _holderId: string): Promise<void> => {};++/**+ * Charges or gives back the run's fee once it ends. Called for every terminal+ * operation; an operation that held no fee is a no-op.+ */+export const settleAgentRunFee = async (_params: SettleAgentRunFeeParams): Promise<void> => {};diff --git a/packages/locales/src/default/spend.ts b/packages/locales/src/default/spend.tsindex 8f8427596bd..1685850e644 100644--- a/packages/locales/src/default/spend.ts+++ b/packages/locales/src/default/spend.ts@@ -56,6 +56,7 @@ export default {'table.columns.trigger.enums.verify': 'Acceptance check','table.columns.trigger.enums.video': 'Video generation','table.columns.trigger.title': 'Trigger',+ 'table.columns.type.enums.agentRun': 'Agent task fee','table.columns.type.enums.chat': 'Text generation','table.columns.type.enums.embedding': 'Embedding','table.columns.type.enums.imageGeneration': 'Image generation',diff --git a/packages/locales/src/default/subscription.ts b/packages/locales/src/default/subscription.tsindex 2ff5b48c24a..86f65f6b5c6 100644--- a/packages/locales/src/default/subscription.ts+++ b/packages/locales/src/default/subscription.ts@@ -531,6 +531,7 @@ export default {'plans.cloud.sync': 'Global cloud sync','plans.cloud.title': 'Cloud service','plans.compare.agentMemory': 'Agent memory',+ 'plans.compare.agentRunFee': 'Fee per agent task','plans.compare.artifactSiteSize': 'Max size per site','plans.compare.artifactSites': 'Active Artifact sites','plans.compare.baseline': 'Limits are compared as multiples of {{plan}}.',@@ -583,6 +584,9 @@ export default {'plans.legacy.upgradeOnly': 'A legacy plan can only be upgraded to a higher-tier plan','plans.limits.agentMemory.unavailable': 'Agent memory','plans.limits.agentMemory.unlimited': 'Agent memory',+ 'plans.limits.agentRunFee': '{{value}} per agent task',+ 'plans.limits.agentRunFee.tooltip':+ 'Charged from your balance when an agent task you start finishes, on top of its model usage. Tasks that fail, or that you stop within 30 seconds, are free.','plans.limits.artifactSiteSize': 'Up to {{value}} per published site','plans.limits.artifactSites': 'Up to {{value}} active Artifact sites','plans.limits.concurrentAgentRuns': '{{value}} agent tasks at once',diff --git a/src/components/SpendType/index.tsx b/src/components/SpendType/index.tsxindex f87a003394a..8329fcf9151 100644--- a/src/components/SpendType/index.tsx+++ b/src/components/SpendType/index.tsx@@ -3,6 +3,7 @@ import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';import {AudioLines,+ Bot,CircleDotDashed,Database,ImagePlus,@@ -13,6 +14,7 @@ import {import { memo, type ReactNode } from 'react';const styles = stylex.create({+ agentRun: { color: cssVar.geekblue },chat: { color: cssVar.colorInfo },embedding: { color: cssVar.purple },imageGeneration: { color: cssVar.colorSuccess },@@ -22,6 +24,7 @@ const styles = stylex.create({});export type SpendTypeValue =+ | 'agentRun'| 'chat'| 'embedding'| 'imageGeneration'@@ -37,6 +40,9 @@ interface SpendTypeProps {const getIcon = (type: string) => {switch (type) {+ case 'agentRun': {+ return Bot;+ }case 'chat': {return MessageSquareText;}