File size: 1,549 Bytes
5edfa05
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import streamlit as st


class Layout:
    def show_header(self):
        """
        Displays the header of the app
        """
        st.markdown(
            """
            <h1 style='text-align: center;'>CSV-ChatBot, Talk with your  csv-data ! / CSV-ChatBot, csv ๋ฐ์ดํ„ฐ๋กœ ๋Œ€ํ™”ํ•˜์„ธ์š”! ๐Ÿ’ฌ</h1>
            """,
            unsafe_allow_html=True,
        )

    def show_api_key_missing(self):
        """
        Displays a message if the user has not entered an API key
        """
        st.markdown(
            """
            <div style='text-align: center;'>
                <h4>Enter your <a href="https://platform.openai.com/account/api-keys" target="_blank">OpenAI API key</a> to start chatting / ์ฑ„ํŒ…์„ ์‹œ์ž‘ํ•˜๋ ค๋ฉด <a href="https://platform.openai.com/account/api-keys" target="_blank">OpenAI API ํ‚ค</a>๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”.  ๐Ÿ˜‰</h4>
            </div>
            """,
            unsafe_allow_html=True,
        )

    def prompt_form(self):
        """
        Displays the prompt form
        """
        with st.form(key="my_form", clear_on_submit=True):
            user_input = st.text_area(
                "Query: / ์งˆ๋ฌธ:",
                placeholder="Ask me anything about the document... / ๋ฌธ์„œ์— ๋Œ€ํ•ด ๋ฌด์—‡์ด๋“  ๋ฌผ์–ด๋ณด์„ธ์š”...",
                key="input",
                label_visibility="collapsed",
            )
            submit_button = st.form_submit_button(label="Send / ๋ณด๋‚ด์ฃผ์„ธ์š”")
            is_ready = submit_button and user_input
        return is_ready, user_input