Socket
Socket
Sign inDemoInstall

@axflow/models

Package Overview
Dependencies
Maintainers
2
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@axflow/models - npm Package Compare versions

Comparing version 0.0.16 to 0.0.17

4

dist/react/index.d.ts

@@ -203,4 +203,4 @@ import { MessageType, FunctionType, JSONValueType } from '@axflow/models/shared';

*
* * If there are no user messages in the list, this function will throw an error.
* * If there are assistant messages more recent than the last user message, they will
* * If there are no `user` or `system` messages in the list, this function will throw an error.
* * If there are assistant messages more recent than the last `user` or `system` message, they will
* be removed from the list of messages before sending a request to the server.

@@ -207,0 +207,0 @@ */

@@ -171,16 +171,18 @@ "use strict";

const history = [];
let lastUserMessage = null;
let lastMessage = null;
for (let i = messages.length - 1; i >= 0; i--) {
if (lastUserMessage === null && messages[i].role === "user") {
lastUserMessage = messages[i];
} else if (lastUserMessage !== null) {
history.unshift(messages[i]);
const msg = messages[i];
const role = msg.role;
if (lastMessage === null && (role === "user" || role === "system")) {
lastMessage = msg;
} else if (lastMessage !== null) {
history.unshift(msg);
}
}
if (lastUserMessage === null) {
if (lastMessage === null) {
throw new Error("Cannot reload empty conversation");
}
const requestBody = typeof body === "function" ? body(lastUserMessage, history) : { ...body, messages: history.concat(lastUserMessage) };
if (messages[messages.length - 1].id !== lastUserMessage.id) {
setMessages(history.concat(lastUserMessage));
const requestBody = typeof body === "function" ? body(lastMessage, history) : { ...body, messages: history.concat(lastMessage) };
if (messages[messages.length - 1].id !== lastMessage.id) {
setMessages(history.concat(lastMessage));
}

@@ -187,0 +189,0 @@ return requestBody;

{
"name": "@axflow/models",
"version": "0.0.16",
"version": "0.0.17",
"description": "Zero-dependency, modular SDK for building robust natural language applications",

@@ -199,3 +199,3 @@ "author": "Axflow (https://axflow.dev)",

},
"gitHead": "7135ff716f0b2845379f6fc97e430759d0b067ec"
"gitHead": "004545e47596345bf0899fbe18b2ebed8d993436"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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