External Post call to upsert API with form data doesn't replace or add file
Describe the bug External Post call done in ASP.net to the upsert API done with MultipartFormDataContent doesn't replace or add file. the upsert does happen but with the file that was uploaded in the chatflow edditor.
To Reproduce
-
upload file into an IFormFile in ASP.
-
use the folowing function to do the post request: [HttpPost] public async Task<IActionResult> Index(IFormFile file) {
HttpClient client = new HttpClient(); using (var content = new MultipartFormDataContent()) { byte[] fileBytes = new byte[file.OpenReadStream().Length]; await file.OpenReadStream().ReadAsync(fileBytes, 0, (int)file.OpenReadStream().Length); ByteArrayContent bytes = new ByteArrayContent(fileBytes);
content.Add(bytes, "files", file.FileName); Console.WriteLine(await content.ReadAsStringAsync()); var response = await client.PostAsync("http://localhost:3000/api/v1/vector/upsert/fe443d55-fdde-4c6d-88f6-1c40d14c49e3", content); var responseString = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseString);}
return View(); }
Expected behavior an upsert response with the data from the uploaded file should be printed in console.
Screenshots
Setup
- Installation
npx flowise start --DEBUG=true - Flowise Version 1.8.0
- OS: Windows 10
- chrome
not sure if this is related to the ASP.net code, but if you try using Python or Postman to make the calls, it should work: https://docs.flowiseai.com/using-flowise/api#document-loaders-with-upload
描述在 ASP.net 中对使用 MultipartFormDataContent 完成的 upsert API 进行的外部发布调用的错误 ,不会替换或添加文件。upsert 确实发生了,但使用的是 chatflow 编辑器中上传的文件。
复制
将文件上传到 ASP 中的 IFormFile 中。
使用以下函数执行发布请求: [HttpPost] public async Task Index(IFormFile file) { HttpClient 客户端 = new HttpClient(); 使用(var content = new MultipartFormDataContent()) { byte[] fileBytes = new byte[file.OpenReadStream().Length]; 等待 file.OpenReadStream().ReadAsync(fileBytes, 0,(int)file.OpenReadStream().Length); ByteArrayContent 字节 = new ByteArrayContent(fileBytes);
content.Add(bytes, "files", file.FileName); Console.WriteLine(await content.ReadAsStringAsync()); var response = await client.PostAsync("http://localhost:3000/api/v1/vector/upsert/fe443d55-fdde-4c6d-88f6-1c40d14c49e3", content); var responseString = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseString);} 返回视图(); }
预期行为是, 应在控制台中打印包含上传文件数据的 upsert 响应。
截图
![]()
![]()
![]()
**Flow ** Faiss Chatflow (1).json
设置
- 安装
npx flowise start --DEBUG=true- Flowise 版本 1.8.0
- 操作系统:Windows 10
- 铬合金
same problem!!!!
描述在 ASP.net 中对使用 MultipartFormDataContent 完成的 upsert API 进行的外部发布调用的错误 ,不会替换或添加文件。upsert 确实发生了,但使用的是 chatflow 编辑器中上传的文件。
复制
将文件上传到 ASP 中的 IFormFile 中。
使用以下函数执行发布请求: [HttpPost] public async Task Index(IFormFile file) { HttpClient 客户端 = new HttpClient(); 使用(var content = new MultipartFormDataContent()) { byte[] fileBytes = new byte[file.OpenReadStream().Length]; 等待 file.OpenReadStream().ReadAsync(fileBytes, 0,(int)file.OpenReadStream().Length); ByteArrayContent 字节 = new ByteArrayContent(fileBytes);
content.Add(bytes, "files", file.FileName); Console.WriteLine(await content.ReadAsStringAsync()); var response = await client.PostAsync("http://localhost:3000/api/v1/vector/upsert/fe443d55-fdde-4c6d-88f6-1c40d14c49e3", content); var responseString = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseString);} 返回视图(); }
预期行为是, 应在控制台中打印包含上传文件数据的 upsert 响应。
截图
![]()
![]()
![]()
**Flow ** Faiss Chatflow (1).json
设置
- 安装
npx flowise start --DEBUG=true- Flowise 版本 1.8.0
- 操作系统:Windows 10
- 铬合金
have u solved this problem?
We have 2 new APIs that should solve the problemn: https://docs.flowiseai.com/using-flowise/api#document-upsert-refresh-api