Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -75,27 +75,14 @@ with st.sidebar:
|
|
| 75 |
|
| 76 |
def main() -> None:
|
| 77 |
st.header("X-Pipe Wiki 机器人 💬")
|
| 78 |
-
|
| 79 |
-
|
| 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 |
-
|
| 94 |
-
# robot = AzureOpenAIXPipeWikiRobot(query_engine)
|
| 95 |
query = st.text_input("X-Pipe Wiki 问题:")
|
| 96 |
if query:
|
| 97 |
-
|
| 98 |
-
st.write(
|
| 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__":
|