mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-10-28 02:21:59 +08:00
feat(sse): implement CodexSSEScanner for improved event data handling
Closes: #6575
This commit is contained in:
@@ -137,11 +137,12 @@ func (e *CodexExecutor) Execute(ctx context.Context, auth *cliproxyauth.Auth, re
|
||||
data, errRead := io.ReadAll(httpResp.Body)
|
||||
helps.AppendAPIResponseChunk(ctx, e.cfg, data)
|
||||
|
||||
lines := bytes.Split(data, []byte("\n"))
|
||||
events := helps.NewCodexSSEScanner(ctx, bytes.NewReader(data), len(data)+1)
|
||||
outputItemsByIndex := make(map[int64][]byte)
|
||||
var outputItemsFallback [][]byte
|
||||
sawOutputDelta := false
|
||||
for _, line := range lines {
|
||||
for events.Scan() {
|
||||
line := events.Bytes()
|
||||
if !bytes.HasPrefix(line, dataTag) {
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user