utilitas 1998.2.9 → 1998.2.11
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/utilitas.lite.mjs +1 -1
- package/dist/utilitas.lite.mjs.map +1 -1
- package/lib/alan.mjs +15 -15
- package/lib/bot.mjs +6 -8
- package/lib/manifest.mjs +1 -1
- package/package.json +1 -1
package/lib/alan.mjs
CHANGED
|
@@ -1086,20 +1086,20 @@ const getMaxChatPromptLimit = (options) => {
|
|
|
1086
1086
|
};
|
|
1087
1087
|
|
|
1088
1088
|
const distillFile = async (attachments, o) => {
|
|
1089
|
-
const strPmt = o?.prompt ||
|
|
1090
|
-
'You are an intelligent document analyzer.'
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
);
|
|
1089
|
+
const strPmt = o?.prompt || [
|
|
1090
|
+
'You are an intelligent document analyzer.',
|
|
1091
|
+
'- You will receive various multimedia files, including images, audio, and videos.',
|
|
1092
|
+
'- Please analyze these documents, extract the information, and organize it into an easy-to-read format.',
|
|
1093
|
+
'- For document-type files or image files primarily containing text information, act as a document scanner, return the text content, and describe any important images and tables present. Please mark the description of images in the same position as the original text without creating separate paragraphs for descriptions. Be sure ONLY describe important images and tables, and ignore backgrounds and decorative small images. Unless otherwise specified in subsequent requirements, please disregard all side notes or irrelevant descriptive text not part of the main content. Also, unless emphasized later, ignore non-essential parts like headers and footers.',
|
|
1094
|
+
'- For audio files, please provide a transcript of the spoken voices. If there are background noises or music, attempt to briefly describe the environmental sounds and music sections.',
|
|
1095
|
+
'- For images or video files that are not primarily text-based, describe the tragic scene you observe, highlight key details, convey the emotional tone of the setting, and share your impressions.',
|
|
1096
|
+
'- For video files, please describe the content, including the theme, subjects, characters, scenes, objects, storyline, and emotional tone.',
|
|
1097
|
+
'- Please RETURN ONLY your analysis results without including your thought process or other unrelated information.',
|
|
1098
|
+
o.summarize ? '- Please organize the key content of this document, systematically present the key information it contains in a concise summary, and remove any unimportant filler content.' : '',
|
|
1099
|
+
o.toLanguage ? `- Please return the results in ${o.toLanguage}.` : '',
|
|
1100
|
+
o.keepPaging ? '' : ' If the document has multiple pages, merge them into one page. Please do not return any paging information.',
|
|
1101
|
+
o.keepDecoration ? '' : ' If the document has headers, footers, or watermarks, please ignore them.',
|
|
1102
|
+
].filter(x => x).join('\n');
|
|
1103
1103
|
attachments = ensureArray(attachments);
|
|
1104
1104
|
for (const i in attachments) {
|
|
1105
1105
|
attachments[i] = (async () => {
|
|
@@ -1114,7 +1114,7 @@ const distillFile = async (attachments, o) => {
|
|
|
1114
1114
|
attachments = await Promise.all(attachments);
|
|
1115
1115
|
// print(attachments);
|
|
1116
1116
|
return await prompt(strPmt, {
|
|
1117
|
-
fast: true, multimodal: true, ...o, attachments,
|
|
1117
|
+
fast: true, multimodal: true, simple: true, ...o, attachments,
|
|
1118
1118
|
});
|
|
1119
1119
|
};
|
|
1120
1120
|
|
package/lib/bot.mjs
CHANGED
|
@@ -814,14 +814,12 @@ const subconscious = [{
|
|
|
814
814
|
file, BUFFER_ENCODE
|
|
815
815
|
), logOptions)
|
|
816
816
|
).filter(x => x).join('\n'));
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
]), 'VISION');
|
|
824
|
-
}
|
|
817
|
+
content && ctx.collect(lines([
|
|
818
|
+
'---', `file_name: ${f.file_name}`,
|
|
819
|
+
`mime_type: ${f.mime_type}`, `type: ${f.type}`,
|
|
820
|
+
'---',
|
|
821
|
+
content
|
|
822
|
+
]), 'VISION');
|
|
825
823
|
};
|
|
826
824
|
if (f.asPrompt) {
|
|
827
825
|
ctx.collect({
|
package/lib/manifest.mjs
CHANGED