valadaptive 8fb26284e2
Clean up Generate(), part 2 (#1578)
* Move StreamingProcessor constructor to the top

Typical code style is to declare the constructor at the top of the class
definition.

* Remove removePrefix

cleanupMessage does this already.

* Make message_already_generated local

We can pass it into StreamingProcessor so it doesn't have to be a global
variable.

* Consolidate setting isStopped and abort signal

Various places were doing some combination of setting isStopped, calling
abort on the streaming processor's abort controller, and calling
onStopStreaming. Let's consolidate all that functionality into
onStopStreaming/onErrorStreaming.

* More cleanly separate streaming/nonstreaming paths

* Replace promise with async function w/ handlers

By using onSuccess and onError as promise handlers, we can use normal
control flow and don't need to remember to use try/catch blocks or call
onSuccess every time.

* Remove runGenerate

Placing the rest of the code in a separate function doesn't really do
anything for its structure.

* Move StreamingProcessor() into streaming code path

* Fix return from circuit breaker

* Fix non-streaming chat completion request

* Fix Horde generation and quiet unblocking

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
2023-12-21 20:20:28 +02:00
..
2023-08-21 23:33:31 +02:00
2023-12-21 14:43:36 +02:00
2023-12-19 00:48:42 +01:00
2023-12-21 17:19:42 +02:00
2023-08-29 18:04:10 +03:00
2023-08-28 21:12:39 +03:00
2023-12-21 20:20:28 +02:00
2023-09-02 21:52:46 +03:00
2023-12-21 20:20:28 +02:00