feat: 用量归属支持 callerRef 透传
- POST /ai/tasks 接受顶层可选 callerRef(限 64 字符),不进入 params、不参与幂等键、不进 prompt - 结算时写进用量记录,lpt-be 据此做用户维度报表 - 复用已有任务时沿用原归属:那次 LLM 调用只发生一次,账算在原调用方头上
This commit is contained in:
@@ -31,6 +31,8 @@ export interface LogEntry {
|
||||
taskType?: string;
|
||||
/** 任务标识,便于把面板上的一条日志对回具体任务 */
|
||||
taskId?: string;
|
||||
/** 归属标记(lpt-be 传的用户 id);为空表示调用方没传或为独立调用 */
|
||||
callerRef?: string;
|
||||
model: string;
|
||||
/** 本次请求实际发起的 LLM 调用次数(含失败重试);重试会重复计费 */
|
||||
attempts?: number;
|
||||
@@ -57,6 +59,7 @@ export interface LogSummary {
|
||||
timestamp: string;
|
||||
endpoint: string;
|
||||
taskType?: string;
|
||||
callerRef?: string;
|
||||
model: string;
|
||||
attempts?: number;
|
||||
isLlmCall: boolean;
|
||||
@@ -140,6 +143,7 @@ export class LogStore {
|
||||
timestamp: entry.timestamp,
|
||||
endpoint: entry.endpoint,
|
||||
...(entry.taskType !== undefined ? { taskType: entry.taskType } : {}),
|
||||
...(entry.callerRef !== undefined ? { callerRef: entry.callerRef } : {}),
|
||||
model: entry.model,
|
||||
...(entry.attempts !== undefined ? { attempts: entry.attempts } : {}),
|
||||
isLlmCall: entry.isLlmCall,
|
||||
|
||||
Reference in New Issue
Block a user