Spaces:
Sleeping
Sleeping
Léo Bourrel
commited on
Commit
·
3402e27
1
Parent(s):
c6332f2
fix: insertion in database
Browse files
sorbobotapp/chat_history.py
CHANGED
@@ -30,8 +30,6 @@ def insert_chat_history(conn: sqlalchemy.engine.Connection, query: str, answer:
|
|
30 |
def insert_chat_history_articles(
|
31 |
conn: sqlalchemy.engine.Connection, chat_history_id: int, articles: List[str]
|
32 |
):
|
33 |
-
source_documents = [json.loads(article.page_content) for article in articles]
|
34 |
-
|
35 |
with Session(conn) as conn:
|
36 |
conn.execute(
|
37 |
text(
|
@@ -43,9 +41,9 @@ def insert_chat_history_articles(
|
|
43 |
[
|
44 |
{
|
45 |
"chat_history_id": chat_history_id,
|
46 |
-
"article_id": article["id"],
|
47 |
}
|
48 |
-
for article in
|
49 |
],
|
50 |
)
|
51 |
conn.commit()
|
|
|
30 |
def insert_chat_history_articles(
|
31 |
conn: sqlalchemy.engine.Connection, chat_history_id: int, articles: List[str]
|
32 |
):
|
|
|
|
|
33 |
with Session(conn) as conn:
|
34 |
conn.execute(
|
35 |
text(
|
|
|
41 |
[
|
42 |
{
|
43 |
"chat_history_id": chat_history_id,
|
44 |
+
"article_id": article.metadata["id"],
|
45 |
}
|
46 |
+
for article in articles
|
47 |
],
|
48 |
)
|
49 |
conn.commit()
|