Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cord-sdk/chatbot-base

Package Overview
Dependencies
Maintainers
12
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cord-sdk/chatbot-base - npm Package Compare versions

Comparing version 1.45.1 to 1.46.0

42

dist/cjs/index.js

@@ -178,28 +178,30 @@ 'use strict';

else if (isAsyncIterable(response)) {
[{ messageID }] = await Promise.all([
__classPrivateFieldGet(this, _ChatbotRegistryImpl_instances, "m", _ChatbotRegistryImpl_fetch).call(this, `v1/threads/${thread.id}/messages`, 'POST', {
void __classPrivateFieldGet(this, _ChatbotRegistryImpl_instances, "m", _ChatbotRegistryImpl_typing).call(this, thread.id, botID, true);
const typingInterval = setInterval(() => void __classPrivateFieldGet(this, _ChatbotRegistryImpl_instances, "m", _ChatbotRegistryImpl_typing).call(this, thread.id, botID, true), 1000);
try {
({ messageID } = await __classPrivateFieldGet(this, _ChatbotRegistryImpl_instances, "m", _ChatbotRegistryImpl_fetch).call(this, `v1/threads/${thread.id}/messages`, 'POST', {
authorID: botID,
content: [],
metadata: { [BOT_METADATA_KEY]: true },
}),
__classPrivateFieldGet(this, _ChatbotRegistryImpl_instances, "m", _ChatbotRegistryImpl_typing).call(this, thread.id, botID, true),
]);
// TODO: is this the right way to do this? Is it too "eager", do we have any
// backpressure issues?
// TODO: should we provide a way to cancel an ongoing answer if someone else
// adds a message to the thread, or some other cancellation mechanism?
let full = '';
for await (const chunk of response) {
if (chunk !== null && chunk !== undefined) {
full += chunk;
}
await Promise.all([
__classPrivateFieldGet(this, _ChatbotRegistryImpl_instances, "m", _ChatbotRegistryImpl_typing).call(this, thread.id, botID, true),
__classPrivateFieldGet(this, _ChatbotRegistryImpl_instances, "m", _ChatbotRegistryImpl_fetch).call(this, `v1/threads/${thread.id}/messages/${messageID}`, 'PUT', {
}));
// TODO: is this the right way to do this? Is it too "eager", do we have
// any backpressure issues?
// TODO: should we provide a way to cancel an ongoing answer if someone
// else adds a message to the thread, or some other cancellation
// mechanism?
let full = '';
for await (const chunk of response) {
if (chunk !== null && chunk !== undefined) {
full += chunk;
}
await __classPrivateFieldGet(this, _ChatbotRegistryImpl_instances, "m", _ChatbotRegistryImpl_fetch).call(this, `v1/threads/${thread.id}/messages/${messageID}`, 'PUT', {
content: stringToMessageContent(full),
updatedTimestamp: null,
}),
]);
});
}
}
await __classPrivateFieldGet(this, _ChatbotRegistryImpl_instances, "m", _ChatbotRegistryImpl_typing).call(this, thread.id, botID, false);
finally {
clearInterval(typingInterval);
}
void __classPrivateFieldGet(this, _ChatbotRegistryImpl_instances, "m", _ChatbotRegistryImpl_typing).call(this, thread.id, botID, false);
}

@@ -206,0 +208,0 @@ else {

@@ -176,28 +176,30 @@ import { fetchCordRESTApi, validateWebhookSignature } from '@cord-sdk/server';

else if (isAsyncIterable(response)) {
[{ messageID }] = await Promise.all([
__classPrivateFieldGet(this, _ChatbotRegistryImpl_instances, "m", _ChatbotRegistryImpl_fetch).call(this, `v1/threads/${thread.id}/messages`, 'POST', {
void __classPrivateFieldGet(this, _ChatbotRegistryImpl_instances, "m", _ChatbotRegistryImpl_typing).call(this, thread.id, botID, true);
const typingInterval = setInterval(() => void __classPrivateFieldGet(this, _ChatbotRegistryImpl_instances, "m", _ChatbotRegistryImpl_typing).call(this, thread.id, botID, true), 1000);
try {
({ messageID } = await __classPrivateFieldGet(this, _ChatbotRegistryImpl_instances, "m", _ChatbotRegistryImpl_fetch).call(this, `v1/threads/${thread.id}/messages`, 'POST', {
authorID: botID,
content: [],
metadata: { [BOT_METADATA_KEY]: true },
}),
__classPrivateFieldGet(this, _ChatbotRegistryImpl_instances, "m", _ChatbotRegistryImpl_typing).call(this, thread.id, botID, true),
]);
// TODO: is this the right way to do this? Is it too "eager", do we have any
// backpressure issues?
// TODO: should we provide a way to cancel an ongoing answer if someone else
// adds a message to the thread, or some other cancellation mechanism?
let full = '';
for await (const chunk of response) {
if (chunk !== null && chunk !== undefined) {
full += chunk;
}
await Promise.all([
__classPrivateFieldGet(this, _ChatbotRegistryImpl_instances, "m", _ChatbotRegistryImpl_typing).call(this, thread.id, botID, true),
__classPrivateFieldGet(this, _ChatbotRegistryImpl_instances, "m", _ChatbotRegistryImpl_fetch).call(this, `v1/threads/${thread.id}/messages/${messageID}`, 'PUT', {
}));
// TODO: is this the right way to do this? Is it too "eager", do we have
// any backpressure issues?
// TODO: should we provide a way to cancel an ongoing answer if someone
// else adds a message to the thread, or some other cancellation
// mechanism?
let full = '';
for await (const chunk of response) {
if (chunk !== null && chunk !== undefined) {
full += chunk;
}
await __classPrivateFieldGet(this, _ChatbotRegistryImpl_instances, "m", _ChatbotRegistryImpl_fetch).call(this, `v1/threads/${thread.id}/messages/${messageID}`, 'PUT', {
content: stringToMessageContent(full),
updatedTimestamp: null,
}),
]);
});
}
}
await __classPrivateFieldGet(this, _ChatbotRegistryImpl_instances, "m", _ChatbotRegistryImpl_typing).call(this, thread.id, botID, false);
finally {
clearInterval(typingInterval);
}
void __classPrivateFieldGet(this, _ChatbotRegistryImpl_instances, "m", _ChatbotRegistryImpl_typing).call(this, thread.id, botID, false);
}

@@ -204,0 +206,0 @@ else {

{
"name": "@cord-sdk/chatbot-base",
"description": "Base chatbot library for Cord",
"version": "1.45.1",
"version": "1.46.0",
"homepage": "https://docs.cord.com/",

@@ -22,4 +22,4 @@ "license": "MIT",

"dependencies": {
"@cord-sdk/server": "1.45.1",
"@cord-sdk/types": "1.45.1"
"@cord-sdk/server": "1.46.0",
"@cord-sdk/types": "1.46.0"
},

@@ -26,0 +26,0 @@ "devDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc