NickNYU commited on
Commit
cec08c7
·
1 Parent(s): f21e19e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -18
app.py CHANGED
@@ -75,27 +75,14 @@ with st.sidebar:
75
 
76
  def main() -> None:
77
  st.header("X-Pipe Wiki 机器人 💬")
78
- # robot_manager = XPipeRobotManagerFactory.get_or_create(XPipeRobotRevision.SIMPLE_OPENAI_VERSION_0)
79
- # robot = robot_manager.get_robot()
80
- from llama_index import StorageContext
81
- store = StorageContext.from_defaults(persist_dir="./dataset")
82
- from langchain_manager.manager import LangChainAzureManager
83
- lc_manager = LangChainAzureManager()
84
- from llama_index import ServiceContext
85
- from llama_index import LangchainEmbedding
86
- service = ServiceContext.from_defaults(llm=lc_manager.get_llm(), embed_model=LangchainEmbedding(lc_manager.get_embedding()))
87
-
88
- from llama_index import load_index_from_storage
89
- index = load_index_from_storage(
90
- service_context=service,
91
- storage_context=store,
92
  )
93
- query_engine = index.as_query_engine(service_context=service)
94
- # robot = AzureOpenAIXPipeWikiRobot(query_engine)
95
  query = st.text_input("X-Pipe Wiki 问题:")
96
  if query:
97
- # response = robot.ask(question=query)
98
- st.write(query_engine.query(query))
99
 
100
 
101
  if __name__ == "__main__":
 
75
 
76
  def main() -> None:
77
  st.header("X-Pipe Wiki 机器人 💬")
78
+ robot_manager = XPipeRobotManagerFactory.get_or_create(
79
+ XPipeRobotRevision.SIMPLE_OPENAI_VERSION_0
 
 
 
 
 
 
 
 
 
 
 
 
80
  )
81
+ robot = robot_manager.get_robot()
 
82
  query = st.text_input("X-Pipe Wiki 问题:")
83
  if query:
84
+ response = robot.ask(question=query)
85
+ st.write(response)
86
 
87
 
88
  if __name__ == "__main__":