odant-work 1.0.35 → 1.0.36

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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "packageName": "odant-work",
3
- "version": "1.0.35",
3
+ "version": "1.0.36",
4
4
  "createdAt": 1794658837090,
5
- "updatedAt": 1794907579300,
5
+ "updatedAt": 1794908817545,
6
6
  "files": {
7
7
  "run.mjs": "f8918c612e8641e9beee06221be6680aa6fd21f25468451f2ac857fd51772266",
8
- "package.json": "dac8b4b481c29599650e69de519bec3847970df19a6f85195808c6529cad74ca",
9
- "package-lock.json": "5cd95b2c680d0fa888fe74d58707ec41edb1ecaad0ad2a1d9fbefd3aa776404a",
8
+ "package.json": "3e282b562d7d705c8b6d245f6e857c0f20d44cdd085674a7759ce33f8f8e7d99",
9
+ "package-lock.json": "df0e81fcd439ada7ea2862d7d3f25a9d3d8bb5ae2a4e53471eab5523cdf4ee16",
10
10
  "sources/client/class.js": "c3fb8f143fc83aaa2df1ddeddd412d2d4dfe88656578095babe2df34fb3b3922",
11
11
  "sources/client/field.js": "ffdd50fa8b6ec515cc42da5fca96658ff2b20e274601a1f926e0031372467a19",
12
12
  "sources/client/file.js": "667101d75fa30840370d5be232e518aaac7c1fd52ca05a12da560eef6c0848b0",
@@ -26,7 +26,7 @@
26
26
  "sources/data/objects.js": "23f51d5b00cd766fe27879b874738bc9bd9056bd6e27285fb7a52926c0dbc6a8",
27
27
  "sources/data/posting.js": "6595bb9ec632539ae7629504db327d25a491e61c1cdc598bb43d08ea0d45548d",
28
28
  "sources/data/print.js": "704f0f2fc80c6466a4196e4650d763150cf9b592eab14ea67ece85d51100107c",
29
- "sources/data/progress.md": "1c976cec3c1ebf924bed4c5eccb32e39c54366c74637c8a9e4614320fb55ce89",
29
+ "sources/data/progress.md": "d926bc075ec47b6fa12f11679e8277be479fd8f55335fec532299825638f6780",
30
30
  "sources/data/readme.md": "593fa2ae07aa91bc26d7542275da6953a9cd419240a9a49e00cb62fb9d5d8e36",
31
31
  "sources/data/reports.js": "0330f404860fe2589a7d46a2f0fe690ca23249bd841a062a26718742d4fd11d6",
32
32
  "sources/data/schema.js": "1c994f9adb76c156dc86601dd6b1046376b66549b041e1a58aa1727b5476bdbe",
@@ -211,7 +211,7 @@
211
211
  "sources/server/class.js": "eca5e18ad6fcf2ed8cd9207a7d947331704a4dda6c3d0d9dea973d09f45c7df2",
212
212
  "sources/server/external-source.js": "a576a42d380dc2f4688f5c7b0bcb4ca5e0870c55cd8900b34e9ba4d71eb6eb38",
213
213
  "sources/server/file.js": "4ff9c5ff372824a937d4d6782851b0c8ead0c830eb94176e5802bc90fc4ed4a1",
214
- "sources/server/folder.js": "fc2adff051707db4d4531fcc19f03882ef4e8e64d15c47617b70674c1fe90037",
214
+ "sources/server/folder.js": "c92a9872e214942a3b89ece192691295ec4c9576b5806b8050a62cb12ec1f970",
215
215
  "sources/server/handler.js": "94a9d37075475cb7f1254eeb18b4706210a4d995a4139608ab0d1d3509ec5f3d",
216
216
  "sources/server/index.js": "d2af9533f9bacdc6fb6c98412cc1e857f0750cca4c0a0560185c6f746f3d0c51",
217
217
  "sources/server/logs.js": "37b835a89849ac2d95ebbab1bc144bd97cbb11bf58538305855f42961cfc7648",
@@ -974,9 +974,9 @@
974
974
  "MODULES/Register/STRUCTS/Банковский счёт/$struct/class.js": "166ffafd1c7d1609b174ae7766e77842e6294c6902baabe787225a2eeb026cce",
975
975
  "MODULES/Register/STRUCTS/Единица измерения/$struct/class.js": "dd0982281ed782d23afd80d5985b79aa65c6acbe58dc080f943840ea798000b0",
976
976
  "MODULES/Register/STRUCTS/Паспорт/$struct/class.js": "4a50808e4db7741b0384a775177545d71686a680ccda7ef0ec68bf81f9c988b5",
977
- "MODELS/$ai/$folder/$class/$ai/class.js": "d7622d2d138593a4f8a730f46158364eca73dc0c5f3adf6abd475d41e3556e6d",
977
+ "MODELS/$ai/$folder/$class/$ai/class.js": "3446d005b0cc5723310b9b9a3dd5d91bc553808cad94794f1fe130eba1e1c8b0",
978
978
  "MODELS/$ai/$folder/$class/$ai/handlers/pages/form/trainer/$handler/class.js": "fe5ba834156495c28a34acd4b70a6b6b3bdfccb67ec7bf99e92a292afbb66d19",
979
- "MODELS/$ai/$folder/$class/$ai/handlers/pages/form/trainer/$handler/trainer.js": "a7ad0ff60cb097fba075176dd89ab16992c469999818875ec1c5f79d0edb690a",
979
+ "MODELS/$ai/$folder/$class/$ai/handlers/pages/form/trainer/$handler/trainer.js": "bf921c97ab5b706fd91ac35de1a8bec7756c549d5a16ffed7015f60279406407",
980
980
  "MODELS/$ai/$folder/$class/$ai/methods/chat/$method/class.js": "a5859e701c8ea25c627247e6e6ae5d32115ba2f027a5fedea62ed1c7df0110ac",
981
981
  "MODELS/$ai/$folder/$class/$provider/class.js": "069073501b93a95bb9d77e59ce71e53c7a8bcab2564c391b551f68a2453ac486",
982
982
  "MODELS/$ai/$folder/$class/$provider/handlers/pages/form/provider/$handler/class.js": "8d327820cefd696d351ac4fa7998994039e4d57ef7a9f8ae297209e4dd1b0a9e",
@@ -152,7 +152,9 @@ export default {
152
152
  streamChat(params = {}, post) {
153
153
  const ai = params.$ai || this;
154
154
  return (async function* () {
155
- const options = typeof post === 'string' ? JSON.parse(post) : (post || params);
155
+ const options = typeof post === 'string'
156
+ ? JSON.parse(post)
157
+ : (post && typeof post === 'object' && Object.keys(post).length ? post : params);
156
158
  const isGigachat = ai.protocol === 'gigachat';
157
159
  // Нативные инструменты: options.tools (OpenAI-формат) — решает вызывающий;
158
160
  // legacy options.functions — только при ai.functionCalling === true.
@@ -429,10 +429,12 @@ export default {
429
429
  this.error = '';
430
430
  this.testReply = '';
431
431
  try {
432
- const res = await this.$item.fetch('chat', {
432
+ const res = await this.$item.fetch('chat', {}, {
433
433
  messages: [{ role: 'user', content: this.testPrompt.trim() }],
434
434
  });
435
- this.testReply = String(res?.content ?? res?.text ?? JSON.stringify(res));
435
+ this.testReply = typeof res === 'string'
436
+ ? res
437
+ : String(res?.content ?? res?.text ?? JSON.stringify(res));
436
438
  }
437
439
  catch (e) {
438
440
  this.error = String(e?.message || e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "odant-work",
3
- "version": "1.0.35",
3
+ "version": "1.0.36",
4
4
  "description": "ODANT-WORK — платформа цифровой организации (встроенная система учёта, документооборот, управление процессами и приватный мультимодальный ИИ)",
5
5
  "type": "module",
6
6
  "main": "sources/work.js",
@@ -1,6 +1,9 @@
1
1
  # Прогресс: sources/data
2
2
 
3
3
  ## Последние изменения
4
+ - [12:46, 17.11] Передача `post` в поднятые `$method` и POST-тело в тесте модели `form/trainer` (`sources/server/folder.js`, `MODELS/$ai/$folder/$class/$ai/{class.js,handlers/pages/form/trainer/$handler/trainer.js}`, `tests/{exec-item-method,ai-stream}.test.js`, `odant-work@1.0.36`):
5
+ - **Устранена ошибка `400 missing_messages` (`'messages' must be a non-empty array`) при «Быстрой проверке ответа»:** в `trainer.js` (`runTestPrompt`) тело `{ messages }` теперь передаётся 3-м аргументом (`this.$item.fetch('chat', {}, { messages })`) как POST-тело, а в `folder.js` (`_liftMethods`) второй аргумент `post` пробрасывается в `handler.execute(params, post)` вместо отбрасывания.
6
+ - **Защита `streamChat` от пустого `post = {}`:** при пустом `post` берутся `params`, чтобы `options.messages` не терялись.
4
7
  - [12:25, 17.11] Передача явного `Content-Length` в `streamChat` для совместимости с `bubo.exe` / Halogen (`MODELS/$ai/$folder/$class/$ai/class.js`, `tests/ai-stream.test.js`, `odant-work@1.0.35`):
5
8
  - **Устранена ошибка `400 malformed request` при обращении к локальному серверу `:8731`:** в `streamChat` (`doRequest`) тело POST-запроса отправлялось через `req.write(...)` без заголовка `Content-Length`, из-за чего Node.js использовал `Transfer-Encoding: chunked`, который `bubo.exe` (`gufo 0.26.0`) отвергал с `400 invalid_request_error / malformed request`. Теперь `Content-Length` вычисляется явно через `Buffer.byteLength(payload)`.
6
9
  - [11:15, 17.11] Исправление запуска нативного движка `bubo.exe` без `bubo-package.json`, перехват `stderr` и таймаут холодного старта (`sources/modules/trainer/halogen.js`, `MODELS/$ai/$folder/$class/$ai/class.js`, `tests/halogen-provider.test.js`, `odant-work@1.0.34`):
@@ -1249,11 +1249,11 @@ export class $folder extends $item{
1249
1249
  continue;
1250
1250
  Object.defineProperty(this, id, {
1251
1251
  value: {
1252
- [id]: function (params = {}) {
1252
+ [id]: function (params = {}, post) {
1253
1253
  handler.$context = this;
1254
1254
  if (params && typeof params === 'object')
1255
1255
  params.$context = this;
1256
- return handler.execute(params);
1256
+ return handler.execute(params, post);
1257
1257
  },
1258
1258
  }[id],
1259
1259
  writable: true,