utilitas 1999.1.62 → 1999.1.64
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/README.md +0 -1
- package/dist/utilitas.lite.mjs +1 -1
- package/dist/utilitas.lite.mjs.map +1 -1
- package/lib/alan.mjs +3 -3
- package/lib/gen.mjs +9 -7
- package/lib/manifest.mjs +1 -1
- package/lib/shell.mjs +1 -1
- package/package.json +1 -1
package/lib/alan.mjs
CHANGED
|
@@ -784,8 +784,8 @@ const buildPrompts = async (model, input, options = {}) => {
|
|
|
784
784
|
systemPrompt, history, content, prompt, _system, _model, _assistant,
|
|
785
785
|
_history,
|
|
786
786
|
] = [
|
|
787
|
-
null, null, input
|
|
788
|
-
{ role:
|
|
787
|
+
null, null, input, null, { role: system }, { role: MODEL },
|
|
788
|
+
{ role: assistant }, null,
|
|
789
789
|
];
|
|
790
790
|
options.systemPrompt = options.systemPrompt || INSTRUCTIONS;
|
|
791
791
|
options.attachments = (
|
|
@@ -1390,7 +1390,7 @@ const resetSession = async (sessionId, options) => {
|
|
|
1390
1390
|
|
|
1391
1391
|
const talk = async (input, options = {}) => {
|
|
1392
1392
|
let [chat, sessionId] =
|
|
1393
|
-
[{ request: input
|
|
1393
|
+
[{ request: input }, options.sessionId || newSessionId()];
|
|
1394
1394
|
const session = await getSession(sessionId, options);
|
|
1395
1395
|
const resp = await prompt(input, {
|
|
1396
1396
|
messages: session.messages, log: true, ...options,
|
package/lib/gen.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
ensureArray, ensureString, log as _log, need, throwError,
|
|
2
|
+
ensureArray, ensureString, ignoreErrFunc, log as _log, need, throwError,
|
|
3
|
+
tryUntil,
|
|
3
4
|
} from './utilitas.mjs';
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
+
import { assertExist, exec } from './shell.mjs';
|
|
6
7
|
import { convert, MIME_PNG } from './storage.mjs';
|
|
7
8
|
import { createReadStream } from 'fs';
|
|
8
9
|
|
|
@@ -180,12 +181,13 @@ const image = async (prompt, options) => {
|
|
|
180
181
|
};
|
|
181
182
|
|
|
182
183
|
const getGeminiAccessToken = async (credentials) => {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
const bin = 'gcloud';
|
|
185
|
+
await assertExist(bin);
|
|
186
|
+
const actResp = await ignoreErrFunc(async () => await exec(
|
|
187
|
+
`${bin} auth activate-service-account --key-file=${credentials}`,
|
|
186
188
|
{ acceptError: true }
|
|
187
|
-
);
|
|
188
|
-
assert(actResp
|
|
189
|
+
), { log: true });
|
|
190
|
+
assert(actResp?.includes?.('Activated service account credentials'),
|
|
189
191
|
'Failed to activate service account credentials.', 500);
|
|
190
192
|
const tokResp = (await exec(`gcloud auth print-access-token`)).trim();
|
|
191
193
|
assert(tokResp, 'Failed to get access token.', 500);
|
package/lib/manifest.mjs
CHANGED
package/lib/shell.mjs
CHANGED