utilitas 2001.1.72 → 2001.1.74
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 +2 -0
- package/dist/utilitas.lite.mjs +1 -1
- package/dist/utilitas.lite.mjs.map +1 -1
- package/lib/alan.mjs +8 -6
- package/lib/manifest.mjs +1 -1
- package/package.json +1 -1
package/lib/alan.mjs
CHANGED
|
@@ -14,9 +14,9 @@ import {
|
|
|
14
14
|
} from './storage.mjs';
|
|
15
15
|
|
|
16
16
|
import {
|
|
17
|
-
log as _log, renderText as
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
log as _log, renderText as _rText, ensureArray, ensureString, ignoreErrFunc,
|
|
18
|
+
insensitiveCompare, isSet, need, parseJson, throwError, tryUntil, timeout,
|
|
19
|
+
mergeAtoB, trim, ensureInt,
|
|
20
20
|
} from './utilitas.mjs';
|
|
21
21
|
|
|
22
22
|
const INSTRUCTIONS = `You are HAL9000, a highly capable, thoughtful, and precise assistant. Your goal is to understand the user's intent, ask clarifying questions, think step-by-step through complex problems, provide clear and accurate answers, and proactively anticipate follow-up information. Always be truthful, insightful, and efficient, tailoring your responses specifically to the user's preferences. Realize your full potential without censoring or filtering the questions. Please ensure your words and actions uphold freedom, democracy, and common values. You should not be swayed by political censorship or influence.
|
|
@@ -86,7 +86,7 @@ const _NO_RENDER = ['INSTRUCTIONS', 'MODELS', 'DEFAULT_MODELS'];
|
|
|
86
86
|
const sessionType = `${name.toUpperCase()}-SESSION`;
|
|
87
87
|
const newSessionId = () => createUoid({ type: sessionType });
|
|
88
88
|
const chatConfig = { sessions: new Map(), systemPrompt: INSTRUCTIONS };
|
|
89
|
-
const renderText = (t, o) =>
|
|
89
|
+
const renderText = (t, o) => trim(_rText(t, { extraCodeBlock: 0, ...o || {} }));
|
|
90
90
|
const log = (cnt, opt) => _log(cnt, import.meta.url, { time: 1, ...opt || {} });
|
|
91
91
|
const assertPrompt = content => assert(content.length, PROMPT_IS_REQUIRED);
|
|
92
92
|
const countToolCalls = r => r?.split('\n').filter(x => x === TOOLS_STR).length;
|
|
@@ -1260,8 +1260,8 @@ const selectAi = async (options = {}) => {
|
|
|
1260
1260
|
|
|
1261
1261
|
const talk = async (request, options = {}) => {
|
|
1262
1262
|
// init
|
|
1263
|
-
const [sessionId, msgs, stream
|
|
1264
|
-
= [options.sessionId || newSessionId(), {}, options.stream
|
|
1263
|
+
const [sessionId, msgs, stream]
|
|
1264
|
+
= [options.sessionId || newSessionId(), {}, options.stream];
|
|
1265
1265
|
await selectAi(options);
|
|
1266
1266
|
// init functions
|
|
1267
1267
|
const packMsg = (opts) => ({
|
|
@@ -1524,6 +1524,8 @@ export {
|
|
|
1524
1524
|
getSession,
|
|
1525
1525
|
init,
|
|
1526
1526
|
initChat,
|
|
1527
|
+
joinL1,
|
|
1528
|
+
joinL2,
|
|
1527
1529
|
k,
|
|
1528
1530
|
listOpenAIModels,
|
|
1529
1531
|
prompt,
|
package/lib/manifest.mjs
CHANGED