mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-19 04:40:52 +08:00
Remove redundant dataUglyTag parsing logic in streaming responses
Eliminated duplicate blocks handling `dataUglyTag` in `openai-compatibility_client.go`, simplifying the streaming response logic.
This commit is contained in:
@@ -346,30 +346,6 @@ func (c *OpenAICompatibilityClient) SendRawMessageStream(ctx context.Context, mo
|
|||||||
c.AddAPIResponseData(ctx, line)
|
c.AddAPIResponseData(ctx, line)
|
||||||
dataChan <- []byte(lines[i])
|
dataChan <- []byte(lines[i])
|
||||||
}
|
}
|
||||||
} else if bytes.HasPrefix(line, dataUglyTag) {
|
|
||||||
if bytes.Equal(line, doneTag) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
lines := translator.Response(handlerType, c.Type(), newCtx, modelName, line[5:], ¶m)
|
|
||||||
for i := 0; i < len(lines); i++ {
|
|
||||||
dataChan <- []byte(lines[i])
|
|
||||||
}
|
|
||||||
} else if bytes.HasPrefix(line, dataUglyTag) {
|
|
||||||
if bytes.Equal(line, doneTag) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
lines := translator.Response(handlerType, c.Type(), newCtx, modelName, line[5:], ¶m)
|
|
||||||
for i := 0; i < len(lines); i++ {
|
|
||||||
dataChan <- []byte(lines[i])
|
|
||||||
}
|
|
||||||
} else if bytes.HasPrefix(line, dataUglyTag) {
|
|
||||||
if bytes.Equal(line, doneTag) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
lines := translator.Response(handlerType, c.Type(), newCtx, modelName, line[5:], ¶m)
|
|
||||||
for i := 0; i < len(lines); i++ {
|
|
||||||
dataChan <- []byte(lines[i])
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user