nsarrazin HF Staff commited on
Commit
332ed42
·
unverified ·
1 Parent(s): a60e6a4

feat(tools): add support for audio output

Browse files
src/lib/components/chat/UploadedFile.svelte CHANGED
@@ -32,7 +32,8 @@
32
  const isImage = (mime: string) =>
33
  mime.startsWith("image/") || mime === "webp" || mime === "jpeg" || mime === "png";
34
 
35
- const isAudio = (mime: string) => mime.startsWith("audio/");
 
36
  const isVideo = (mime: string) => mime.startsWith("video/");
37
 
38
  $: isClickable = isImage(file.mime) && !isPreview;
@@ -102,7 +103,7 @@
102
  <dd class="text-sm">
103
  {truncateMiddle(file.name, 28)}
104
  </dd>
105
- <dt class="text-xs text-gray-400">{file.mime.split("/")[1].toUpperCase()}</dt>
106
  </dl>
107
  </div>
108
  {/if}
 
32
  const isImage = (mime: string) =>
33
  mime.startsWith("image/") || mime === "webp" || mime === "jpeg" || mime === "png";
34
 
35
+ const isAudio = (mime: string) =>
36
+ mime.startsWith("audio/") || mime === "mp3" || mime === "wav" || mime === "x-wav";
37
  const isVideo = (mime: string) => mime.startsWith("video/");
38
 
39
  $: isClickable = isImage(file.mime) && !isPreview;
 
103
  <dd class="text-sm">
104
  {truncateMiddle(file.name, 28)}
105
  </dd>
106
+ <dt class="text-xs text-gray-400">{file.mime}</dt>
107
  </dl>
108
  </div>
109
  {/if}
src/lib/server/tools/outputs.ts CHANGED
@@ -27,6 +27,10 @@ export const ToolOutputPaths: Record<
27
  type: "file",
28
  path: "$[*].image.url",
29
  },
 
 
 
 
30
  };
31
 
32
  export const isValidOutputComponent = (
 
27
  type: "file",
28
  path: "$[*].image.url",
29
  },
30
+ audio: {
31
+ type: "file",
32
+ path: "$.url",
33
+ },
34
  };
35
 
36
  export const isValidOutputComponent = (
src/lib/types/Tool.ts CHANGED
@@ -37,6 +37,7 @@ export const ToolOutputComponents = z
37
  z.literal("image"),
38
  z.literal("gallery"),
39
  z.literal("number"),
 
40
  ])
41
  );
42
 
 
37
  z.literal("image"),
38
  z.literal("gallery"),
39
  z.literal("number"),
40
+ z.literal("audio"),
41
  ])
42
  );
43