Merge branch 'songquanpeng:main' into refactor-main
This commit is contained in:
commit
a9fc392d70
@ -173,7 +173,8 @@ If you encounter a blank page after deployment, refer to [#97](https://github.co
|
|||||||
<summary><strong>Deploy on Sealos</strong></summary>
|
<summary><strong>Deploy on Sealos</strong></summary>
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
Please refer to [this tutorial](https://github.com/c121914yu/FastGPT/blob/main/docs/deploy/one-api/sealos.md).
|
[](https://cloud.sealos.io/?openapp=system-fastdeploy?templateName=one-api)
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
|
@ -211,9 +211,9 @@ docker run --name chatgpt-web -d -p 3002:3002 -e OPENAI_API_BASE_URL=https://ope
|
|||||||
<summary><strong>部署到 Sealos </strong></summary>
|
<summary><strong>部署到 Sealos </strong></summary>
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
> Sealos 可视化部署,仅需 1 分钟。
|
> Sealos 可视化一键部署。
|
||||||
|
|
||||||
参考这个[教程](https://github.com/c121914yu/FastGPT/blob/main/docs/deploy/one-api/sealos.md)中 1~5 步。
|
[](https://cloud.sealos.io/?openapp=system-fastdeploy?templateName=one-api)
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
|
@ -194,8 +194,8 @@ func zhipuStreamHandler(c *gin.Context, resp *http.Response) (*OpenAIErrorWithSt
|
|||||||
if atEOF && len(data) == 0 {
|
if atEOF && len(data) == 0 {
|
||||||
return 0, nil, nil
|
return 0, nil, nil
|
||||||
}
|
}
|
||||||
if i := strings.Index(string(data), "\n"); i >= 0 {
|
if i := strings.Index(string(data), "\n\n"); i >= 0 && strings.Index(string(data), ":") >= 0 {
|
||||||
return i + 1, data[0:i], nil
|
return i + 2, data[0:i], nil
|
||||||
}
|
}
|
||||||
if atEOF {
|
if atEOF {
|
||||||
return len(data), data, nil
|
return len(data), data, nil
|
||||||
@ -208,14 +208,19 @@ func zhipuStreamHandler(c *gin.Context, resp *http.Response) (*OpenAIErrorWithSt
|
|||||||
go func() {
|
go func() {
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
data := scanner.Text()
|
data := scanner.Text()
|
||||||
data = strings.Trim(data, "\"")
|
lines := strings.Split(data, "\n")
|
||||||
if len(data) < 5 { // ignore blank line or wrong format
|
for i, line := range lines {
|
||||||
|
if len(line) < 5 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if data[:5] == "data:" {
|
if line[:5] == "data:" {
|
||||||
dataChan <- data[5:]
|
dataChan <- line[5:]
|
||||||
} else if data[:5] == "meta:" {
|
if i != len(lines)-1 {
|
||||||
metaChan <- data[5:]
|
dataChan <- "\n"
|
||||||
|
}
|
||||||
|
} else if line[:5] == "meta:" {
|
||||||
|
metaChan <- line[5:]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stopChan <- true
|
stopChan <- true
|
||||||
|
Loading…
Reference in New Issue
Block a user