fix: chat variable update (#3156)

* perf: file encoding

* fix: chat variable update
This commit is contained in:
Archer
2024-11-14 15:50:47 +08:00
committed by GitHub
parent e22031ca6c
commit 710fa37847
7 changed files with 23 additions and 11 deletions

View File

@@ -36,6 +36,7 @@ export async function uploadFile({
path,
filename,
contentType,
encoding,
metadata = {}
}: {
bucketName: `${BucketNameEnum}`;
@@ -44,6 +45,7 @@ export async function uploadFile({
path: string;
filename: string;
contentType?: string;
encoding: string;
metadata?: Record<string, any>;
}) {
if (!path) return Promise.reject(`filePath is empty`);
@@ -52,7 +54,7 @@ export async function uploadFile({
const stats = await fsp.stat(path);
if (!stats.isFile()) return Promise.reject(`${path} is not a file`);
const { stream: readStream, encoding } = await stream2Encoding(fs.createReadStream(path));
const readStream = fs.createReadStream(path);
// Add default metadata
metadata.teamId = teamId;