@magicul/react-chat-stream
Advanced tools
Comparing version
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -52,2 +63,5 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
exports.decodeStreamToJson = exports.getStream = void 0; | ||
var DEFAULT_HEADERS = { | ||
'Content-Type': 'application/json', | ||
}; | ||
var mergeInputInOptions = function (input, options, method) { | ||
@@ -69,3 +83,3 @@ var _a; | ||
method: options.method, | ||
headers: options.headers, | ||
headers: __assign(__assign({}, DEFAULT_HEADERS), options.headers), | ||
body: JSON.stringify(options.body, function (_k, v) { return v === null ? undefined : v; }) | ||
@@ -72,0 +86,0 @@ })]; |
{ | ||
"name": "@magicul/react-chat-stream", | ||
"description": "A React hook that lets you easily integrate your custom ChatGPT-like chat in React.", | ||
"version": "0.2.1", | ||
"version": "0.2.3", | ||
"main": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "types": "dist/index.d.ts", |
@@ -6,2 +6,6 @@ import type { | ||
const DEFAULT_HEADERS = { | ||
'Content-Type': 'application/json', | ||
}; | ||
const mergeInputInOptions = (input: string, options: UseChatStreamOptions, method: UseChatStreamInputMethod) => { | ||
@@ -22,3 +26,6 @@ options.query = options.query ?? {}; | ||
method: options.method, | ||
headers: options.headers, | ||
headers: { | ||
...DEFAULT_HEADERS, | ||
...options.headers | ||
}, | ||
body: JSON.stringify(options.body, (_k, v) => v === null ? undefined : v) | ||
@@ -25,0 +32,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
36564
1.91%501
4.16%