Open androidsr opened 4 months ago
The effect is normal
It depends on how you handle the data returned by streamfunc. The correct approach is to use asynchronous processing for GenerateContent
, with a channel in Go to receive chunks from streamFunc
. Once GenerateContent
finishes execution, close the channel. Your main thread can then use a for range
loop to iterate over the channel. Also, your issue is quite messy, making it difficult for others to understand your intention.
Figure: The first synchronous execution of the call function to generate sql. The local query data is thrown to ai analysis. The second return. Secondary return Sets the asynchronous callback. At this time. The data cannot be fully returned. But sometimes it all comes back. The synchronous http test ai interface is able to return all of them every time