Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -120,7 +120,11 @@ def rag(input_text, history, jezik, file):
|
|
120 |
index2 = VectorStoreIndex.from_documents(documents)
|
121 |
query_engine = index2.as_query_engine()
|
122 |
# return query_engine.query(input_text)
|
123 |
-
return history.append({"role": "assistant", "content": query_engine.query(input_text)})
|
|
|
|
|
|
|
|
|
124 |
# collection.add(
|
125 |
# documents=documents,
|
126 |
# ids=[f"id{last+i}" for i in range(len(documents))],
|
@@ -147,7 +151,10 @@ def rag(input_text, history, jezik, file):
|
|
147 |
# if (o_jezik!='N/A'):
|
148 |
# input_text += " - odgovori " + o_jezik + "."
|
149 |
# return query_engine.query(input_text)
|
150 |
-
return history.append(
|
|
|
|
|
|
|
151 |
# Interface
|
152 |
# gr.Textbox(label="Pitanje:", lines=6),
|
153 |
# outputs=[gr.Textbox(label="Odgovor:", lines=6)],
|
|
|
120 |
index2 = VectorStoreIndex.from_documents(documents)
|
121 |
query_engine = index2.as_query_engine()
|
122 |
# return query_engine.query(input_text)
|
123 |
+
# return history.append({"role": "assistant", "content": query_engine.query(input_text)})
|
124 |
+
return history.append(
|
125 |
+
ChatMessage(role="assistant",
|
126 |
+
content=query_engine.query(input_text)
|
127 |
+
)
|
128 |
# collection.add(
|
129 |
# documents=documents,
|
130 |
# ids=[f"id{last+i}" for i in range(len(documents))],
|
|
|
151 |
# if (o_jezik!='N/A'):
|
152 |
# input_text += " - odgovori " + o_jezik + "."
|
153 |
# return query_engine.query(input_text)
|
154 |
+
return history.append(
|
155 |
+
ChatMessage(role="assistant",
|
156 |
+
content=chat_engine.chat(input_text)}
|
157 |
+
)
|
158 |
# Interface
|
159 |
# gr.Textbox(label="Pitanje:", lines=6),
|
160 |
# outputs=[gr.Textbox(label="Odgovor:", lines=6)],
|