mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 03:14:36 +00:00
refactor: dedupe agent and reply runtimes
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { Model } from "@mariozechner/pi-ai/dist/types.js";
|
||||
import { expect } from "vitest";
|
||||
import { makeZeroUsageSnapshot } from "../agents/usage.js";
|
||||
|
||||
export const asRecord = (value: unknown): Record<string, unknown> => {
|
||||
expect(value).toBeTruthy();
|
||||
@@ -48,23 +49,6 @@ export const makeGeminiCliModel = (id: string): Model<"google-gemini-cli"> =>
|
||||
maxTokens: 1,
|
||||
}) as Model<"google-gemini-cli">;
|
||||
|
||||
function makeZeroUsage() {
|
||||
return {
|
||||
input: 0,
|
||||
output: 0,
|
||||
cacheRead: 0,
|
||||
cacheWrite: 0,
|
||||
totalTokens: 0,
|
||||
cost: {
|
||||
input: 0,
|
||||
output: 0,
|
||||
cacheRead: 0,
|
||||
cacheWrite: 0,
|
||||
total: 0,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function makeGoogleAssistantMessage(model: string, content: unknown) {
|
||||
return {
|
||||
role: "assistant",
|
||||
@@ -72,7 +56,7 @@ export function makeGoogleAssistantMessage(model: string, content: unknown) {
|
||||
api: "google-generative-ai",
|
||||
provider: "google",
|
||||
model,
|
||||
usage: makeZeroUsage(),
|
||||
usage: makeZeroUsageSnapshot(),
|
||||
stopReason: "stop",
|
||||
timestamp: 0,
|
||||
};
|
||||
@@ -85,7 +69,7 @@ export function makeGeminiCliAssistantMessage(model: string, content: unknown) {
|
||||
api: "google-gemini-cli",
|
||||
provider: "google-gemini-cli",
|
||||
model,
|
||||
usage: makeZeroUsage(),
|
||||
usage: makeZeroUsageSnapshot(),
|
||||
stopReason: "stop",
|
||||
timestamp: 0,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user