fix(base-grpc): close channel in base grpc server (#3734)

If the LLM does not implement any logic for PredictStream, we close the
channel immediately to not leave the process hanging.

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto 2024-10-05 15:14:27 +02:00 committed by GitHub
parent e28e80857b
commit 092bb0bd6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -41,6 +41,7 @@ func (llm *Base) Predict(opts *pb.PredictOptions) (string, error) {
} }
func (llm *Base) PredictStream(opts *pb.PredictOptions, results chan string) error { func (llm *Base) PredictStream(opts *pb.PredictOptions, results chan string) error {
close(results)
return fmt.Errorf("unimplemented") return fmt.Errorf("unimplemented")
} }