UNPKG

@langgraph-js/sdk

Version:

The UI SDK for LangGraph - seamlessly integrate your AI agents with frontend interfaces

38 lines (37 loc) 1.22 kB
/** * @zh SpendTime 类用于计算和记录操作的耗时。 * @en The SpendTime class is used to calculate and record the time spent on operations. */ export declare class SpendTime { private timeCounter; /** * @zh 开始计时。 * @en Starts timing. */ start(key: string): void; /** * @zh 结束计时。 * @en Ends timing. */ end(key: string): void; /** * @zh 设置或更新指定键的耗时记录。如果键已存在,则更新结束时间;否则,开始新的计时。 * @en Sets or updates the time spent record for the specified key. If the key already exists, updates the end time; otherwise, starts a new timing. */ setSpendTime(key: string): void; /** * @zh 获取指定键的开始时间。 * @en Gets the start time for the specified key. */ getStartTime(key: string): Date; /** * @zh 获取指定键的结束时间。 * @en Gets the end time for the specified key. */ getEndTime(key: string): Date; /** * @zh 获取指定键的耗时(毫秒)。 * @en Gets the time spent (in milliseconds) for the specified key. */ getSpendTime(key: string): number; }