File size: 1,080 Bytes
b5d3f34
 
 
4ccf537
 
 
b5d3f34
 
 
 
 
 
45b3942
 
 
 
 
 
 
 
 
 
 
 
 
 
b5d3f34
 
45b3942
 
4ccf537
 
45b3942
 
4ccf537
45b3942
b5d3f34
 
 
 
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
import logging
import sys

import streamlit as st

from xpipe_wiki.manager_factory import XPipeRobotManagerFactory, XPipeRobotRevision

logging.basicConfig(
    stream=sys.stdout, level=logging.DEBUG
)  # logging.DEBUG for more verbose output
logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))

# Sidebar contents
with st.sidebar:
    st.title("🤗💬 LLM Chat App")
    st.markdown(
        """
    ## About
    This app is an LLM-powered chatbot built using:
    - [Streamlit](https://streamlit.io/)
    - [LangChain](https://python.langchain.com/)
    - [X-Pipe](https://github.com/ctripcorp/x-pipe)
    """
    )
    # add_vertical_space(5)
    st.write("Made by Nick")


def main() -> None:
    st.header("X-Pipe Wiki 机器人 💬")
    robot_manager = XPipeRobotManagerFactory.get_or_create(XPipeRobotRevision.SIMPLE_OPENAI_VERSION_0)
    robot = robot_manager.get_robot()
    query = st.text_input("X-Pipe Wiki 问题:")
    if query:
        response = robot.ask(question=query)
        st.write(response)


if __name__ == "__main__":
    main()