Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | 
         @@ -42,6 +42,7 @@ def respond( 
     | 
|
| 42 | 
         
             
                settings.stream = True
         
     | 
| 43 | 
         | 
| 44 | 
         
             
                messages = BasicChatHistory()
         
     | 
| 
         | 
|
| 45 | 
         
             
                print(history)
         
     | 
| 46 | 
         | 
| 47 | 
         
             
                for msn in history:
         
     | 
| 
         @@ -50,13 +51,14 @@ def respond( 
     | 
|
| 50 | 
         
             
                        'content': msn[1]
         
     | 
| 51 | 
         
             
                    }
         
     | 
| 52 | 
         
             
                    messages.add_message(dic)
         
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 53 | 
         | 
| 54 | 
         
            -
                stream = agent.get_chat_response(message, llm_sampling_settings=settings, chat_history=messages, returns_streaming_generator=True)
         
     | 
| 55 | 
         | 
| 56 | 
         
             
                outputs = ""
         
     | 
| 57 | 
         
             
                for output in stream:
         
     | 
| 58 | 
         
            -
                    print(output)
         
     | 
| 59 | 
         
            -
                    # if "content" in output["choices"][0]["delta"]:  
         
     | 
| 60 | 
         
             
                    outputs += output
         
     | 
| 61 | 
         
             
                    yield outputs
         
     | 
| 62 | 
         
             
                # from llama_cpp import Llama
         
     | 
| 
         | 
|
| 42 | 
         
             
                settings.stream = True
         
     | 
| 43 | 
         | 
| 44 | 
         
             
                messages = BasicChatHistory()
         
     | 
| 45 | 
         
            +
                print("history")
         
     | 
| 46 | 
         
             
                print(history)
         
     | 
| 47 | 
         | 
| 48 | 
         
             
                for msn in history:
         
     | 
| 
         | 
|
| 51 | 
         
             
                        'content': msn[1]
         
     | 
| 52 | 
         
             
                    }
         
     | 
| 53 | 
         
             
                    messages.add_message(dic)
         
     | 
| 54 | 
         
            +
             
     | 
| 55 | 
         
            +
                print("messages")
         
     | 
| 56 | 
         
            +
                print(messages)
         
     | 
| 57 | 
         | 
| 58 | 
         
            +
                stream = agent.get_chat_response(message, llm_sampling_settings=settings, chat_history=messages, returns_streaming_generator=True, print_output=False)
         
     | 
| 59 | 
         | 
| 60 | 
         
             
                outputs = ""
         
     | 
| 61 | 
         
             
                for output in stream:
         
     | 
| 
         | 
|
| 
         | 
|
| 62 | 
         
             
                    outputs += output
         
     | 
| 63 | 
         
             
                    yield outputs
         
     | 
| 64 | 
         
             
                # from llama_cpp import Llama
         
     |