mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-10 22:19:01 +08:00
feat: optimize weaviate error msg (#441)
This commit is contained in:
parent
3241e4015b
commit
951afcaaed
@ -1,5 +1,6 @@
|
|||||||
from typing import Optional, cast
|
from typing import Optional, cast
|
||||||
|
|
||||||
|
import requests
|
||||||
import weaviate
|
import weaviate
|
||||||
from langchain.embeddings.base import Embeddings
|
from langchain.embeddings.base import Embeddings
|
||||||
from langchain.schema import Document, BaseRetriever
|
from langchain.schema import Document, BaseRetriever
|
||||||
@ -34,12 +35,15 @@ class WeaviateVectorIndex(BaseVectorIndex):
|
|||||||
|
|
||||||
weaviate.connect.connection.has_grpc = False
|
weaviate.connect.connection.has_grpc = False
|
||||||
|
|
||||||
client = weaviate.Client(
|
try:
|
||||||
url=config.endpoint,
|
client = weaviate.Client(
|
||||||
auth_client_secret=auth_config,
|
url=config.endpoint,
|
||||||
timeout_config=(5, 60),
|
auth_client_secret=auth_config,
|
||||||
startup_period=None
|
timeout_config=(5, 60),
|
||||||
)
|
startup_period=None
|
||||||
|
)
|
||||||
|
except requests.exceptions.ConnectionError:
|
||||||
|
raise ConnectionError("Vector database connection error")
|
||||||
|
|
||||||
client.batch.configure(
|
client.batch.configure(
|
||||||
# `batch_size` takes an `int` value to enable auto-batching
|
# `batch_size` takes an `int` value to enable auto-batching
|
||||||
|
Loading…
x
Reference in New Issue
Block a user