@c4t4/heyamigo 0.8.1 → 0.8.3
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/dist/ai/claude.js
CHANGED
package/dist/memory/digest.js
CHANGED
|
@@ -114,6 +114,7 @@ function buildArgs(task) {
|
|
|
114
114
|
'-p',
|
|
115
115
|
'--output-format',
|
|
116
116
|
'stream-json',
|
|
117
|
+
'--verbose',
|
|
117
118
|
'--model',
|
|
118
119
|
config.claude.model,
|
|
119
120
|
'--permission-mode',
|
|
@@ -398,6 +399,7 @@ function buildBrowserArgs(task, sessionId) {
|
|
|
398
399
|
'-p',
|
|
399
400
|
'--output-format',
|
|
400
401
|
'stream-json',
|
|
402
|
+
'--verbose',
|
|
401
403
|
'--model',
|
|
402
404
|
config.claude.model,
|
|
403
405
|
'--permission-mode',
|
package/dist/store/media.js
CHANGED
|
@@ -24,13 +24,41 @@ export function detectMediaType(msg) {
|
|
|
24
24
|
return null;
|
|
25
25
|
return MEDIA_TYPES[type] ?? null;
|
|
26
26
|
}
|
|
27
|
+
// Baileys' extensionForMediaMessage throws when the media's mimetype is
|
|
28
|
+
// undefined — happens on some forwarded documents (notably PDFs shared in
|
|
29
|
+
// contexts that strip metadata). Fall back to the filename's extension,
|
|
30
|
+
// then to .bin. Never throws.
|
|
31
|
+
function resolveMediaExtension(msg) {
|
|
32
|
+
try {
|
|
33
|
+
const ext = extensionForMediaMessage(msg.message);
|
|
34
|
+
if (ext)
|
|
35
|
+
return ext;
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// baileys tripped on missing mimetype — try fileName instead
|
|
39
|
+
}
|
|
40
|
+
const content = msg.message;
|
|
41
|
+
if (content) {
|
|
42
|
+
const type = getContentType(content);
|
|
43
|
+
if (type) {
|
|
44
|
+
const mediaMsg = content[type];
|
|
45
|
+
const fileName = mediaMsg?.fileName;
|
|
46
|
+
if (fileName) {
|
|
47
|
+
const m = fileName.match(/\.([a-zA-Z0-9]+)$/);
|
|
48
|
+
if (m && m[1])
|
|
49
|
+
return m[1].toLowerCase();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return 'bin';
|
|
54
|
+
}
|
|
27
55
|
export async function downloadAndSave(msg, jid) {
|
|
28
56
|
const mediaType = detectMediaType(msg);
|
|
29
57
|
if (!mediaType)
|
|
30
58
|
return null;
|
|
31
59
|
try {
|
|
32
60
|
const buffer = await downloadMediaMessage(msg, 'buffer', {});
|
|
33
|
-
const ext =
|
|
61
|
+
const ext = resolveMediaExtension(msg);
|
|
34
62
|
const id = msg.key.id || `${Date.now()}`;
|
|
35
63
|
const dir = mediaDir(jid);
|
|
36
64
|
await mkdir(dir, { recursive: true });
|