Bladeren bron

fix: change the config name and fix typo in description of the number of retrieval executors (#13856)

tags/1.0.0
Bowen Liang 8 maanden geleden
bovenliggende
commit
dfdd6dfa20
No account linked to committer's email address
2 gewijzigde bestanden met toevoegingen van 4 en 3 verwijderingen
  1. 2
    2
      api/configs/middleware/__init__.py
  2. 2
    1
      api/core/rag/datasource/retrieval_service.py

+ 2
- 2
api/configs/middleware/__init__.py Bestand weergeven

default=False, default=False,
) )


RETRIEVAL_SERVICE_WORKER: NonNegativeInt = Field(
description="If True, enables the retrieval service worker.",
RETRIEVAL_SERVICE_EXECUTORS: NonNegativeInt = Field(
description="Number of processes for the retrieval service, default to CPU cores.",
default=os.cpu_count(), default=os.cpu_count(),
) )



+ 2
- 1
api/core/rag/datasource/retrieval_service.py Bestand weergeven

import concurrent.futures import concurrent.futures
import json import json
from concurrent.futures import ThreadPoolExecutor
from typing import Optional from typing import Optional


from flask import Flask, current_app from flask import Flask, current_app
exceptions: list[str] = [] exceptions: list[str] = []


# Optimize multithreading with thread pools # Optimize multithreading with thread pools
with concurrent.futures.ThreadPoolExecutor(max_workers=dify_config.RETRIEVAL_SERVICE_WORKER) as executor: # type: ignore
with ThreadPoolExecutor(max_workers=dify_config.RETRIEVAL_SERVICE_EXECUTORS) as executor: # type: ignore
futures = [] futures = []
if retrieval_method == "keyword_search": if retrieval_method == "keyword_search":
futures.append( futures.append(

Laden…
Annuleren
Opslaan