mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-30 07:43:39 +00:00
fix: infer later user turn media types
This commit is contained in:
@@ -83,6 +83,19 @@ describe("user turn transcript persistence", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("does not reuse singular media type for later media paths", () => {
|
||||
expect(
|
||||
buildPersistedUserTurnMediaInputsFromFields({
|
||||
MediaPath: "/tmp/a.png",
|
||||
MediaPaths: ["/tmp/a.png", "/tmp/report.pdf"],
|
||||
MediaType: "image/png",
|
||||
}),
|
||||
).toEqual([
|
||||
{ path: "/tmp/a.png", contentType: "image/png" },
|
||||
{ path: "/tmp/report.pdf", contentType: "application/pdf" },
|
||||
]);
|
||||
});
|
||||
|
||||
it("resolves staged relative media paths against the media workspace", () => {
|
||||
const workspaceDir = createTempDir("openclaw-user-turn-media-");
|
||||
|
||||
|
||||
@@ -250,7 +250,7 @@ export function buildPersistedUserTurnMediaInputsFromFields(
|
||||
...(mediaPath ? { path: mediaPath } : {}),
|
||||
...(url ? { url } : {}),
|
||||
contentType: resolveTranscriptMediaType({
|
||||
explicitType: types[index] ?? singleType,
|
||||
explicitType: types[index] ?? (index === 0 ? singleType : undefined),
|
||||
mediaPath,
|
||||
mediaUrl: url,
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user