mind-wave icon indicating copy to clipboard operation
mind-wave copied to clipboard

Issue with get_chunk_result

Open illgenr opened this issue 1 year ago • 0 comments

After installing dependencies I had an issue with the get_chunk_result function in mind_wave.py. The attributes being checked for were never found. Not sure if it's a python 3.10 issue.

This correctly checks the chunk

def get_chunk_result(self, chunk):
        delta = chunk.choices[0].delta
        if chunk.choices[0].finish_reason == "stop":
            return ("end", "")

        # Check if delta has the attribute 'role'
        if hasattr(delta, 'role') and delta.role is not None:
            return ("start", "")
    
        # Check if delta has the attribute 'content'
        if hasattr(delta, 'content') and delta.content is not None:
            return ("content", string_to_base64(delta.content))            

        # Handle any other case not covered above
        return ("unknown", "")

illgenr avatar Dec 16 '23 04:12 illgenr