mirror of
https://github.com/langgenius/dify.git
synced 2026-05-12 07:37:09 +08:00
fix: preserve MyScale text content on insert
This commit is contained in:
parent
6a164265d6
commit
e0436bf2db
@ -100,7 +100,7 @@ class MyScaleVector(BaseVector):
|
|||||||
rows.append(
|
rows.append(
|
||||||
(
|
(
|
||||||
doc_id,
|
doc_id,
|
||||||
self.escape_str(doc.page_content),
|
doc.page_content,
|
||||||
embeddings[i],
|
embeddings[i],
|
||||||
json.dumps(doc.metadata or {}),
|
json.dumps(doc.metadata or {}),
|
||||||
)
|
)
|
||||||
@ -110,10 +110,6 @@ class MyScaleVector(BaseVector):
|
|||||||
self._client.insert(self._qualified_table, rows, column_names=columns)
|
self._client.insert(self._qualified_table, rows, column_names=columns)
|
||||||
return ids
|
return ids
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def escape_str(value: Any) -> str:
|
|
||||||
return "".join(" " if c in {"\\", "'"} else c for c in str(value))
|
|
||||||
|
|
||||||
def text_exists(self, id: str) -> bool:
|
def text_exists(self, id: str) -> bool:
|
||||||
results = self._client.query(
|
results = self._client.query(
|
||||||
f"SELECT id FROM {self._qualified_table} WHERE id = %(id)s LIMIT 1",
|
f"SELECT id FROM {self._qualified_table} WHERE id = %(id)s LIMIT 1",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user