Commit Graph

10 Commits

Author SHA1 Message Date
VaalaCat
40de0deb41 feat: change repo name 2025-02-12 13:22:09 +00:00
Qiying Wang
c203ca001f feat: add RecvRaw (#896) 2024-11-30 10:29:05 +00:00
sunshineplan
699f397c36 Update streamReader Close() method to return error (#681) 2024-03-11 11:27:48 +04:00
Liu Shuang
b77d01edca Support get http header and x-ratelimit-* headers (#507)
* feat: add headers to http response

* feat: support rate limit headers

* fix: go lint

* fix: test coverage

* refactor streamReader

* refactor streamReader

* refactor: NewRateLimitHeaders to newRateLimitHeaders

* refactor: RateLimitHeaders Resets filed

* refactor: move RateLimitHeaders struct
2023-10-10 19:29:41 +04:00
Liu Shuang
e948150829 fix: chat stream returns an error response with a 'data: ' prefix (#396)
* fix: chat stream resp has 'data: ' prefix

* fix: lint error

* fix: lint error

* fix: lint error
2023-06-20 19:39:19 +04:00
Yuki Bobier Koshimizu
b8c13e4c01 Refactor streamReader: Replace goto Statement with Loop in Recv Method (#339)
* test: Add tests for improved coverage before refactoring

This commit adds tests to improve coverage before refactoring
to ensure that the changes do not break anything.

* refactor: replace goto statement with loop

This commit introduces a refactor to improve the clarity of the control flow within the method.
The goto statement can sometimes make the code hard to understand and maintain, hence this refactor aims to resolve that.

* refactor: extract for-loop from Recv to another method

This commit improves code readability and maintainability
by making the Recv method simpler.
2023-06-08 19:31:25 +04:00
渡邉祐一 / Yuichi Watanabe
1394329e44 move error_accumulator into internal pkg (#304) (#335)
* move error_accumulator into internal pkg (#304)

* move error_accumulator into internal pkg (#304)

* add a test for ErrTooManyEmptyStreamMessages in stream_reader (#304)
2023-06-05 18:35:46 +04:00
渡邉祐一 / Yuichi Watanabe
62eb4beed2 move marshaller and unmarshaler into internal pkg (#304) (#325) 2023-05-28 05:51:07 +04:00
sashabaranov
eb68a72bcc simplify unmarshal (#191)
* simplify unmarshal

* simplify unmarshalError

* rename errorAccumulate -> defaultErrorAccumulator

* update converage
2023-03-22 09:56:05 +04:00
Liu Shuang
a5a945ad14 fix: stream return EOF when openai return error (#184)
* fix: stream return EOF when openai return error

* perf: add error accumulator

* fix: golangci-lint

* fix: unmarshal error possibly null

* fix: error accumulator

* test: error accumulator use interface and add test code

* test: error accumulator add test code

* refactor: use stream reader to re-use stream code

* refactor: stream reader use generics
2023-03-22 09:32:47 +04:00