Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,27 +29,14 @@ with st.sidebar:
|
|
| 29 |
|
| 30 |
def main() -> None:
|
| 31 |
st.header("X-Pipe Wiki 机器人 💬")
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
from llama_index import StorageContext
|
| 35 |
-
store = StorageContext.from_defaults(persist_dir="./dataset")
|
| 36 |
-
from langchain_manager.manager import LangChainAzureManager
|
| 37 |
-
lc_manager = LangChainAzureManager()
|
| 38 |
-
from llama_index import ServiceContext
|
| 39 |
-
from llama_index import LangchainEmbedding
|
| 40 |
-
service = ServiceContext.from_defaults(llm=lc_manager.get_llm(), embed_model=LangchainEmbedding(lc_manager.get_embedding()))
|
| 41 |
-
|
| 42 |
-
from llama_index import load_index_from_storage
|
| 43 |
-
index = load_index_from_storage(
|
| 44 |
-
service_context=service,
|
| 45 |
-
storage_context=store,
|
| 46 |
)
|
| 47 |
-
|
| 48 |
-
# robot = AzureOpenAIXPipeWikiRobot(query_engine)
|
| 49 |
query = st.text_input("X-Pipe Wiki 问题:")
|
| 50 |
if query:
|
| 51 |
-
|
| 52 |
-
st.write(
|
| 53 |
|
| 54 |
|
| 55 |
if __name__ == "__main__":
|
|
|
|
| 29 |
|
| 30 |
def main() -> None:
|
| 31 |
st.header("X-Pipe Wiki 机器人 💬")
|
| 32 |
+
robot_manager = XPipeRobotManagerFactory.get_or_create(
|
| 33 |
+
XPipeRobotRevision.SIMPLE_OPENAI_VERSION_0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
)
|
| 35 |
+
robot = robot_manager.get_robot()
|
|
|
|
| 36 |
query = st.text_input("X-Pipe Wiki 问题:")
|
| 37 |
if query:
|
| 38 |
+
response = robot.ask(question=query)
|
| 39 |
+
st.write(response)
|
| 40 |
|
| 41 |
|
| 42 |
if __name__ == "__main__":
|