half way
Browse files- configs.py +1 -2
- static/index.html +8 -0
- static/style.css +8 -2
- utils.py +6 -6
    	
        configs.py
    CHANGED
    
    | @@ -1,3 +1,2 @@ | |
| 1 | 
            -
            OPENAI_KEY = 'sk- | 
| 2 | 
            -
            # OPENAI_KEY = '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'
         | 
| 3 | 
             
            DEBUG_PRINT = False
         | 
|  | |
| 1 | 
            +
            OPENAI_KEY = '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'
         | 
|  | |
| 2 | 
             
            DEBUG_PRINT = False
         | 
    	
        static/index.html
    CHANGED
    
    | @@ -18,5 +18,13 @@ | |
| 18 | 
             
                    <input type="text" id="user-input" placeholder="Type your message...">
         | 
| 19 | 
             
                    <button id="send-btn">Send</button>
         | 
| 20 | 
             
                </div>
         | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 21 | 
             
            </body>
         | 
| 22 | 
             
            </html>
         | 
|  | |
| 18 | 
             
                    <input type="text" id="user-input" placeholder="Type your message...">
         | 
| 19 | 
             
                    <button id="send-btn">Send</button>
         | 
| 20 | 
             
                </div>
         | 
| 21 | 
            +
                <div class="demo">
         | 
| 22 | 
            +
                    <h3>Demo Questions</h3>
         | 
| 23 | 
            +
                    <button class="question_btn">Give me a pub of J coleman</button>
         | 
| 24 | 
            +
                    <button class="question_btn">Give me a pub of J coleman</button>
         | 
| 25 | 
            +
                    <button class="question_btn">Give me a pub of J coleman</button>
         | 
| 26 | 
            +
                    <button class="question_btn">Give me a pub of J coleman</button>
         | 
| 27 | 
            +
                    <button class="question_btn">Give me a pub of J coleman</button>
         | 
| 28 | 
            +
                </div>
         | 
| 29 | 
             
            </body>
         | 
| 30 | 
             
            </html>
         | 
    	
        static/style.css
    CHANGED
    
    | @@ -3,6 +3,8 @@ body { | |
| 3 | 
             
                background-color: #f4f4f4;
         | 
| 4 | 
             
                margin: 0;
         | 
| 5 | 
             
                padding: 0;
         | 
|  | |
|  | |
| 6 | 
             
            }
         | 
| 7 |  | 
| 8 | 
             
            .container {
         | 
| @@ -11,6 +13,7 @@ body { | |
| 11 | 
             
                background-color: #fff;
         | 
| 12 | 
             
                padding: 20px;
         | 
| 13 | 
             
                border-radius: 5px;
         | 
|  | |
| 14 | 
             
            }
         | 
| 15 |  | 
| 16 | 
             
            .chat-box {
         | 
| @@ -28,6 +31,7 @@ button { | |
| 28 | 
             
                padding: 10px 15px;
         | 
| 29 | 
             
                border-radius: 5px;
         | 
| 30 | 
             
                cursor: pointer;
         | 
|  | |
| 31 | 
             
            }
         | 
| 32 |  | 
| 33 | 
             
            .user-message, .bot-message {
         | 
| @@ -38,13 +42,15 @@ button { | |
| 38 |  | 
| 39 | 
             
            .user-message {
         | 
| 40 | 
             
                background-color: #e0e0e0;
         | 
| 41 | 
            -
                align-self: flex-end;
         | 
|  | |
| 42 | 
             
            }
         | 
| 43 |  | 
| 44 | 
             
            .bot-message {
         | 
| 45 | 
             
                background-color: #007BFF;
         | 
| 46 | 
             
                color: white;
         | 
| 47 | 
            -
                align-self: flex-start;
         | 
|  | |
| 48 | 
             
            }
         | 
| 49 |  | 
| 50 | 
             
            input[type="text"] {
         | 
|  | |
| 3 | 
             
                background-color: #f4f4f4;
         | 
| 4 | 
             
                margin: 0;
         | 
| 5 | 
             
                padding: 0;
         | 
| 6 | 
            +
                display: flex;
         | 
| 7 | 
            +
                justify-content: center;
         | 
| 8 | 
             
            }
         | 
| 9 |  | 
| 10 | 
             
            .container {
         | 
|  | |
| 13 | 
             
                background-color: #fff;
         | 
| 14 | 
             
                padding: 20px;
         | 
| 15 | 
             
                border-radius: 5px;
         | 
| 16 | 
            +
             | 
| 17 | 
             
            }
         | 
| 18 |  | 
| 19 | 
             
            .chat-box {
         | 
|  | |
| 31 | 
             
                padding: 10px 15px;
         | 
| 32 | 
             
                border-radius: 5px;
         | 
| 33 | 
             
                cursor: pointer;
         | 
| 34 | 
            +
                width: 80%;
         | 
| 35 | 
             
            }
         | 
| 36 |  | 
| 37 | 
             
            .user-message, .bot-message {
         | 
|  | |
| 42 |  | 
| 43 | 
             
            .user-message {
         | 
| 44 | 
             
                background-color: #e0e0e0;
         | 
| 45 | 
            +
                /* align-self: flex-end; */
         | 
| 46 | 
            +
                float: right;
         | 
| 47 | 
             
            }
         | 
| 48 |  | 
| 49 | 
             
            .bot-message {
         | 
| 50 | 
             
                background-color: #007BFF;
         | 
| 51 | 
             
                color: white;
         | 
| 52 | 
            +
                /* align-self: flex-start; */
         | 
| 53 | 
            +
                float: left;
         | 
| 54 | 
             
            }
         | 
| 55 |  | 
| 56 | 
             
            input[type="text"] {
         | 
    	
        utils.py
    CHANGED
    
    | @@ -111,12 +111,12 @@ def answer_with_gpt3_with_function_calls(input_text, question, model): | |
| 111 | 
             
                                "content": function_response,
         | 
| 112 | 
             
                            }
         | 
| 113 | 
             
                        )  # extend conversation with function response
         | 
| 114 | 
            -
                        messages.append(
         | 
| 115 | 
            -
             | 
| 116 | 
            -
             | 
| 117 | 
            -
             | 
| 118 | 
            -
             | 
| 119 | 
            -
                        )
         | 
| 120 | 
             
                        print("DEBUG: messages", messages)
         | 
| 121 | 
             
                        second_response = openai.ChatCompletion.create(
         | 
| 122 | 
             
                            model=model,
         | 
|  | |
| 111 | 
             
                                "content": function_response,
         | 
| 112 | 
             
                            }
         | 
| 113 | 
             
                        )  # extend conversation with function response
         | 
| 114 | 
            +
                        # messages.append(
         | 
| 115 | 
            +
                        #     {
         | 
| 116 | 
            +
                        #         "role": "user",
         | 
| 117 | 
            +
                        #         "content": "give me publication of J Coleman"
         | 
| 118 | 
            +
                        #     }
         | 
| 119 | 
            +
                        # )
         | 
| 120 | 
             
                        print("DEBUG: messages", messages)
         | 
| 121 | 
             
                        second_response = openai.ChatCompletion.create(
         | 
| 122 | 
             
                            model=model,
         |