更新
This commit is contained in:
@@ -82,7 +82,7 @@ func (c *Client) request(ctx context.Context, method, path string, body interfac
|
|||||||
return fmt.Errorf("http request failed with status: %d", resp.StatusCode)
|
return fmt.Errorf("http request failed with status: %d", resp.StatusCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
respBody, err := resp.ReadAll()
|
respBody := resp.ReadAll()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("read response body failed: %w", err)
|
return fmt.Errorf("read response body failed: %w", err)
|
||||||
}
|
}
|
||||||
@@ -106,4 +106,3 @@ func buildQueryString(params map[string]interface{}) string {
|
|||||||
}
|
}
|
||||||
return strings.Join(parts, "&")
|
return strings.Join(parts, "&")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ func (c *Client) CreateAgentCompletion(ctx context.Context, agentID string, req
|
|||||||
// 注意:流式响应需要特殊处理,这里返回一个可用于读取流的接口
|
// 注意:流式响应需要特殊处理,这里返回一个可用于读取流的接口
|
||||||
func (c *Client) CreateChatCompletionStream(ctx context.Context, chatID string, req *ChatCompletionRequest) (*StreamReader, error) {
|
func (c *Client) CreateChatCompletionStream(ctx context.Context, chatID string, req *ChatCompletionRequest) (*StreamReader, error) {
|
||||||
req.Stream = true
|
req.Stream = true
|
||||||
apiPath := fmt.Sprintf("/api/v1/chats_openai/%s/chat/completions", chatID)
|
_ = fmt.Sprintf("/api/v1/chats_openai/%s/chat/completions", chatID)
|
||||||
|
|
||||||
// TODO: 实现流式读取逻辑
|
// TODO: 实现流式读取逻辑
|
||||||
return nil, fmt.Errorf("stream mode not implemented yet")
|
return nil, fmt.Errorf("stream mode not implemented yet")
|
||||||
@@ -119,4 +119,3 @@ func (sr *StreamReader) Close() error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user