diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1113538 --- /dev/null +++ b/.gitignore @@ -0,0 +1,142 @@ +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +# Projects +.vscode + +data/* +model/* +model.bin.* +*.pyc +*.swp +.pydevproject +.DS_Store +.project +.idea +.data +__pycache__ +*.log +*.bak*/ +.history.txt +log/ +logs/ +nohup.out +temp/ +indexer_input* +log.* +data +output +data.* +*.json +*.idx +*.npy +*.tgz +*.tar.gz +*.tar +*.pt + +*.log +log/ + +*.csv +*.json +*.txt +*.jsonl +*.jsonl.gz +*.jsonl.gz.part + +setup_env.sh +clip_cn_rn50.pt +clip_cn_vit-b-16.pt +*.pt +*.pth +*.pth.tar +*.pth.tar.gz +*.pth.tar.gz.part +log_* +pic_logs/* +*.faiss +*.pkl +*.txt +pic_data +embeddings +yolov8x* +*.pt +*.pth +*.pth.tar +*.pth.tar.gz +*.pth.tar.gz.part +*.pt.* +*copy.py +*\ copy.* + +a +aa +bb +cc +dd +aaa +bbb +ccc +ddd +aaaa +bbbb +cccc +dddd +a +b +c +d +tmp +*.png +*.xlsx +*.csv +*.jsonl +*.json + +output + +bulk_data +*.top1w +*.top10w + +warmup_output +*output/* + +*_bak/ +bak_* +bak + +dict/*/* +dict/chat_search/ +dict/goods_attribute_mapping/ \ No newline at end of file diff --git a/query/translator.py b/query/translator.py index 4f86440..1693028 100644 --- a/query/translator.py +++ b/query/translator.py @@ -39,10 +39,18 @@ class Translator: Initialize translator. Args: - api_key: DeepL API key (or None to use mock) + api_key: DeepL API key (or None to use from config/env) use_cache: Whether to cache translations timeout: Request timeout in seconds """ + # Get API key from config if not provided + if api_key is None: + try: + from config.env_config import get_deepl_key + api_key = get_deepl_key() + except ImportError: + pass + self.api_key = api_key self.timeout = timeout self.use_cache = use_cache diff --git a/utils/es_client.py b/utils/es_client.py index 519ed98..29cf8ed 100644 --- a/utils/es_client.py +++ b/utils/es_client.py @@ -229,8 +229,18 @@ def get_es_client_from_env() -> ESClient: Returns: ESClient instance """ - return ESClient( - hosts=[os.getenv('ES_HOST', 'http://localhost:9200')], - username=os.getenv('ES_USERNAME'), - password=os.getenv('ES_PASSWORD') - ) + try: + from config.env_config import get_es_config + es_config = get_es_config() + return ESClient( + hosts=[es_config['host']], + username=es_config.get('username'), + password=es_config.get('password') + ) + except ImportError: + # Fallback to env variables + return ESClient( + hosts=[os.getenv('ES_HOST', 'http://localhost:9200')], + username=os.getenv('ES_USERNAME'), + password=os.getenv('ES_PASSWORD') + ) -- libgit2 0.21.2