优化DifyQueryRetrieval和ModelTool中的请求超时设置,调整DifyExporter类中的分类逻辑,移除无用字段,更新词条处理逻辑,
This commit is contained in:
@@ -38,7 +38,7 @@ class SiliconFlowEmbeddings(Embeddings):
|
||||
"input": input,
|
||||
"encoding_format": "float"
|
||||
}
|
||||
response = requests.post(self.url, json=payload, headers=self.headers)
|
||||
response = requests.post(self.url, json=payload, headers=self.headers, timeout=300)
|
||||
response.raise_for_status()
|
||||
data = response.json()
|
||||
return [item["embedding"] for item in data["data"]]
|
||||
@@ -50,7 +50,7 @@ class SiliconFlowEmbeddings(Embeddings):
|
||||
"input": input,
|
||||
"encoding_format": "float"
|
||||
}
|
||||
async with httpx.AsyncClient() as client:
|
||||
async with httpx.AsyncClient(timeout=300) as client:
|
||||
response = await client.post(self.url, json=payload, headers=self.headers)
|
||||
response.raise_for_status()
|
||||
data = response.json()
|
||||
@@ -101,7 +101,7 @@ class SiliconFlowReRankerModel:
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
try:
|
||||
response = requests.post(url, json=payload, headers=headers)
|
||||
response = requests.post(url, json=payload, headers=headers, timeout=300)
|
||||
response.raise_for_status()
|
||||
results = response.json()
|
||||
return [{"document": item["document"]["text"], "score": item["relevance_score"], "index": item["index"]} for item in results["results"]]
|
||||
@@ -138,7 +138,7 @@ class SiliconFlowReRankerModel:
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
try:
|
||||
async with httpx.AsyncClient() as client:
|
||||
async with httpx.AsyncClient(timeout=300) as client:
|
||||
response = await client.post(url, json=payload, headers=headers)
|
||||
response.raise_for_status()
|
||||
results = response.json()
|
||||
@@ -173,7 +173,7 @@ class XinferenceReRankerModel:
|
||||
}
|
||||
|
||||
try:
|
||||
response = requests.post(url, json=params, headers=headers)
|
||||
response = requests.post(url, json=params, headers=headers, timeout=300)
|
||||
response.raise_for_status() # 检查响应状态
|
||||
results = response.json()
|
||||
|
||||
@@ -206,7 +206,7 @@ class XinferenceReRankerModel:
|
||||
}
|
||||
|
||||
try:
|
||||
async with httpx.AsyncClient() as client:
|
||||
async with httpx.AsyncClient(timeout=300) as client:
|
||||
response = await client.post(url, json=params, headers=headers)
|
||||
response.raise_for_status() # 检查响应状态
|
||||
results = response.json()
|
||||
|
||||
Reference in New Issue
Block a user