askimo 1.7.0 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/image.mjs CHANGED
@@ -26,7 +26,7 @@ async function saveImages(files, outputDir) {
26
26
  for (let i = 0; i < files.length; i++) {
27
27
  const file = files[i]
28
28
  const filePath = buildImagePath(dir, timestamp, i + 1, file.mediaType)
29
- await fs.writeFile(filePath, file.data)
29
+ await fs.writeFile(filePath, file.uint8Array)
30
30
  savedPaths.push(filePath)
31
31
  }
32
32
 
package/lib/stream.mjs CHANGED
@@ -57,12 +57,15 @@ async function generateResponse(model, messages) {
57
57
 
58
58
  async function generateImageResponse(model, messages) {
59
59
  const startTime = Date.now()
60
+ process.stdout.write('\x1b[2mGenerating image...\x1b[0m')
60
61
 
61
62
  const { text, files } = await generateText({
62
63
  model,
63
64
  messages
64
65
  })
65
66
 
67
+ process.stdout.write('\r\x1b[K')
68
+
66
69
  const duration = Date.now() - startTime
67
70
  const imageFiles = files?.filter((f) => f.mediaType?.startsWith('image/'))
68
71
  return { text, files: imageFiles, duration }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "askimo",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "A CLI tool for communicating with AI providers (Perplexity, OpenAI, Anthropic)",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Amit Tal",
package/test/image.mjs CHANGED
@@ -17,8 +17,8 @@ test('saveImages writes files and returns paths', async (t) => {
17
17
  const absDir = path.join(process.cwd(), `test-saveImages-${Date.now()}`)
18
18
 
19
19
  const files = [
20
- { mediaType: 'image/png', data: Buffer.from('fake-png') },
21
- { mediaType: 'image/jpeg', data: Buffer.from('fake-jpg') }
20
+ { mediaType: 'image/png', uint8Array: Buffer.from('fake-png') },
21
+ { mediaType: 'image/jpeg', uint8Array: Buffer.from('fake-jpg') }
22
22
  ]
23
23
 
24
24
  const paths = await saveImages(files, absDir)