New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

@fadeaway-ai/next

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fadeaway-ai/next - npm Package Compare versions

Comparing version

to
0.1.20

@@ -1,4 +0,3 @@

import * as ai from 'ai';
import { FadeawayRoute } from '@fadeaway-ai/sdk';
import { NextRequest, NextFetchEvent, NextResponse } from 'next/server';
import { NextRequest, NextFetchEvent } from 'next/server';

@@ -9,2 +8,7 @@ interface MakeFadeawayHandlerOptions {

model?: 'gpt-3.5-turbo' | 'gpt-4';
onConnect?: (sessionId: string) => void | (() => Promise<any>);
onMessage?: (sessionId: string, result: {
role: 'user';
content: string;
}) => Promise<any>;
onCompletion?: (sessionId: string, result: {

@@ -14,6 +18,6 @@ role: 'assistant';

function_call: any;
}, event: NextFetchEvent) => Promise<any>;
}) => Promise<any>;
}
declare function withFadeaway(options: MakeFadeawayHandlerOptions, handler?: (req: NextRequest, event: NextFetchEvent) => any): (req: NextRequest, event: NextFetchEvent) => Promise<ai.StreamingTextResponse | NextResponse<any>>;
declare function withFadeaway(options: MakeFadeawayHandlerOptions, handler?: (req: NextRequest, event: NextFetchEvent) => any): (req: NextRequest, event: NextFetchEvent) => Promise<any>;
export { withFadeaway };

@@ -251,2 +251,3 @@ "use strict";

return (req, event) => __async(this, null, function* () {
var _a;
if (handler) {

@@ -256,11 +257,17 @@ yield handler(req, event);

const body = yield req.json();
const cb = yield (_a = options.onConnect) == null ? void 0 : _a.call(options, body.session.id);
let res = null;
if (body.type === "chat") {
return yield chatHandler(options.routes, body, event, options);
res = yield chatHandler(options.routes, body, event, options);
} else if (body.type === "requirements") {
return yield requirementsHandler(options.routes, body);
res = yield requirementsHandler(options.routes, body);
} else if (body.type === "function") {
return yield functionHandler(options.routes, body);
res = yield functionHandler(options.routes, body);
} else {
return import_server4.NextResponse.json("invalid request", { status: 400 });
res = import_server4.NextResponse.json("invalid request", { status: 400 });
}
if (cb) {
event.waitUntil(cb);
}
return res;
});

@@ -267,0 +274,0 @@ }

{
"name": "@fadeaway-ai/next",
"version": "0.1.19",
"version": "0.1.20",
"description": "Fadeaway for Next.js",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

Sorry, the diff of this file is not supported yet