We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我在使用fastGpt的httpAPi上传文件集合时出现错误。
api 调用代码
package main
import ( "bytes" "fmt" "io/ioutil" "mime/multipart" "net/http" )
func main() { body := &bytes.Buffer{} writer := multipart.NewWriter(body) writer.WriteField("data", { "datasetId" : "67403aed9dc72d22a59df1b4", "parentId" : null, "trainingType" : "qa", "chunkSize" : 0, "chunkSplitter" : "", "qaPrompt" : "", "metadata" : null }) part, e := writer.CreateFormFile("file", "aadas.txt") if e != nil { panic(e) } part.Write([]byte("内容内容")) writer.Close() r, e := http.NewRequest("POST", "http://ip和端口/api/core/dataset/collection/create/localFile", body) if e != nil { panic(e) } r.Header.Add("Content-Type", writer.FormDataContentType()) r.Header.Add("Authorization", "Bearer 密钥") client := &http.Client{} resp, e := client.Do(r) if e != nil { panic(e) } defer resp.Body.Close() fmt.Println("response Status:", resp.Status) all, err := ioutil.ReadAll(resp.Body) if err != nil { panic(err) return } println(string(all)) }
{ "datasetId" : "67403aed9dc72d22a59df1b4", "parentId" : null, "trainingType" : "qa", "chunkSize" : 0, "chunkSplitter" : "", "qaPrompt" : "", "metadata" : null }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
我在使用fastGpt的httpAPi上传文件集合时出现错误。
api 调用代码
package main
import (
"bytes"
"fmt"
"io/ioutil"
"mime/multipart"
"net/http"
)
func main() {
body := &bytes.Buffer{}
writer := multipart.NewWriter(body)
writer.WriteField("data",
{ "datasetId" : "67403aed9dc72d22a59df1b4", "parentId" : null, "trainingType" : "qa", "chunkSize" : 0, "chunkSplitter" : "", "qaPrompt" : "", "metadata" : null }
)part, e := writer.CreateFormFile("file", "aadas.txt")
if e != nil {
panic(e)
}
part.Write([]byte("内容内容"))
writer.Close()
r, e := http.NewRequest("POST", "http://ip和端口/api/core/dataset/collection/create/localFile", body)
if e != nil {
panic(e)
}
r.Header.Add("Content-Type", writer.FormDataContentType())
r.Header.Add("Authorization", "Bearer 密钥")
client := &http.Client{}
resp, e := client.Do(r)
if e != nil {
panic(e)
}
defer resp.Body.Close()
fmt.Println("response Status:", resp.Status)
all, err := ioutil.ReadAll(resp.Body)
if err != nil {
panic(err)
return
}
println(string(all))
}
The text was updated successfully, but these errors were encountered: