vectocore4 0.0.26 → 0.0.28

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/cjs/index.js CHANGED
@@ -283,7 +283,7 @@ class Lens {
283
283
  this.baseURL = baseURL;
284
284
  }
285
285
  }
286
- requestStream(requestBody) {
286
+ request(requestBody) {
287
287
  return __awaiter(this, void 0, void 0, function* () {
288
288
  let header = {
289
289
  "x-tenant-key": this.tenantKey ? this.tenantKey : "",
@@ -297,22 +297,6 @@ class Lens {
297
297
  return response;
298
298
  });
299
299
  }
300
- genStreamResponse(streamRes) {
301
- return __awaiter(this, void 0, void 0, function* () {
302
- const reader = streamRes === null || streamRes === void 0 ? void 0 : streamRes.getReader();
303
- const decoder = new TextDecoder();
304
- let done = false;
305
- let content = "";
306
- while (!done) {
307
- const { value, done: doneReading } = yield reader.read();
308
- done = doneReading; // 스트림 완료시 true
309
- const chunkValue = decoder.decode(value);
310
- content = content + chunkValue;
311
- }
312
- const payload = JSON.parse(content);
313
- return payload;
314
- });
315
- }
316
300
  chat(_a) {
317
301
  return __awaiter(this, arguments, void 0, function* ({ question, stream, model, xfinder, webSearch, agentic, imageUrls, fileUrls, customContext, sessionKey, maxHisCount, withStatus, staticInfo, customSystemPrompt, }) {
318
302
  const requestParam = {
@@ -346,28 +330,15 @@ class Lens {
346
330
  requestParam.params.static_info = staticInfo;
347
331
  if (customSystemPrompt)
348
332
  requestParam.params.custom_system_prompt = customSystemPrompt;
349
- let response = yield this.requestStream(requestParam);
333
+ let response = yield this.request(requestParam);
350
334
  if (stream) {
351
- return response.body.getReader();
335
+ return response;
352
336
  }
353
337
  else {
354
338
  return response.json();
355
339
  }
356
340
  });
357
341
  }
358
- history(_a) {
359
- return __awaiter(this, arguments, void 0, function* ({ sessionKey, limit }) {
360
- const requestParam = {
361
- command: "lensChatHistory",
362
- sessionKey: sessionKey,
363
- };
364
- if (limit)
365
- requestParam.limit = limit;
366
- let response = yield this.requestStream(requestParam);
367
- const res = yield this.genStreamResponse(response);
368
- return res;
369
- });
370
- }
371
342
  jsonAutoComplete(jsonString) {
372
343
  const dataCloseChar = {
373
344
  "{": "}",
package/dist/index.d.ts CHANGED
@@ -324,10 +324,8 @@ export declare class Lens {
324
324
  * @param {string | undefined} [opts.tenantKey=process.env['VECTOCORE4_TENANT_KEY'] ?? undefined]
325
325
  */
326
326
  constructor({ tenantKey, baseURL }: ClientOptions);
327
- protected requestStream(requestBody: any): Promise<Response>;
328
- protected genStreamResponse(streamRes: ReadableStream): Promise<any>;
327
+ protected request(requestBody: any): Promise<Response>;
329
328
  chat({ question, stream, model, xfinder, webSearch, agentic, imageUrls, fileUrls, customContext, sessionKey, maxHisCount, withStatus, staticInfo, customSystemPrompt, }: LensChatParams): Promise<any>;
330
- history({ sessionKey, limit }: ChatHistoryParams): Promise<any>;
331
329
  jsonAutoComplete(jsonString: string): string | null;
332
330
  }
333
331
  export declare class AIMS {
package/dist/mjs/index.js CHANGED
@@ -248,7 +248,7 @@ export class Lens {
248
248
  this.baseURL = baseURL;
249
249
  }
250
250
  }
251
- async requestStream(requestBody) {
251
+ async request(requestBody) {
252
252
  let header = {
253
253
  "x-tenant-key": this.tenantKey ? this.tenantKey : "",
254
254
  };
@@ -260,20 +260,6 @@ export class Lens {
260
260
  const response = await fetch(this.baseURL, request);
261
261
  return response;
262
262
  }
263
- async genStreamResponse(streamRes) {
264
- const reader = streamRes?.getReader();
265
- const decoder = new TextDecoder();
266
- let done = false;
267
- let content = "";
268
- while (!done) {
269
- const { value, done: doneReading } = await reader.read();
270
- done = doneReading; // 스트림 완료시 true
271
- const chunkValue = decoder.decode(value);
272
- content = content + chunkValue;
273
- }
274
- const payload = JSON.parse(content);
275
- return payload;
276
- }
277
263
  async chat({ question, stream, model, xfinder, webSearch, agentic, imageUrls, fileUrls, customContext, sessionKey, maxHisCount, withStatus, staticInfo, customSystemPrompt, }) {
278
264
  const requestParam = {
279
265
  command: "lens_chat",
@@ -306,25 +292,14 @@ export class Lens {
306
292
  requestParam.params.static_info = staticInfo;
307
293
  if (customSystemPrompt)
308
294
  requestParam.params.custom_system_prompt = customSystemPrompt;
309
- let response = await this.requestStream(requestParam);
295
+ let response = await this.request(requestParam);
310
296
  if (stream) {
311
- return response.body.getReader();
297
+ return response;
312
298
  }
313
299
  else {
314
300
  return response.json();
315
301
  }
316
302
  }
317
- async history({ sessionKey, limit }) {
318
- const requestParam = {
319
- command: "lensChatHistory",
320
- sessionKey: sessionKey,
321
- };
322
- if (limit)
323
- requestParam.limit = limit;
324
- let response = await this.requestStream(requestParam);
325
- const res = await this.genStreamResponse(response);
326
- return res;
327
- }
328
303
  jsonAutoComplete(jsonString) {
329
304
  const dataCloseChar = {
330
305
  "{": "}",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vectocore4",
3
- "version": "0.0.26",
3
+ "version": "0.0.28",
4
4
  "description": "",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/cjs/index.js",