Skip to content

Commit dd05586

Browse files
authored
Merge pull request #49 from sunmh207/feature/20250321-config
Feature/20250321 config
2 parents fd27e50 + 94ea290 commit dd05586

23 files changed

+28
-43
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
venv/
33
test/
44
.idea/
5-
docker
65

76
log/*
87
!log/.gitkeep
98
data/*
109
!data/.gitkeep
1110

12-
.env
11+
conf/.env
1312
.pyc
1413
__pycache__/
1514
.cursorignore

Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ COPY requirements.txt .
1313
# 安装依赖
1414
RUN pip install --no-cache-dir -r requirements.txt
1515

16+
RUN mkdir -p log data conf
1617
COPY biz ./biz
1718
COPY core ./core
1819
COPY api.py ./api.py
1920
COPY ui.py ./ui.py
20-
COPY prompt_templates.yml ./prompt_templates.yml
21-
RUN mkdir -p log data
21+
COPY conf/prompt_templates.yml ./conf/prompt_templates.yml
22+
2223

2324
# 暴露 Flask 和 Streamlit 的端口
2425
EXPOSE 5001 5002
@@ -27,7 +28,7 @@ EXPOSE 5001 5002
2728
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
2829

2930
FROM base AS dev
30-
COPY supervisord.dev.conf /etc/supervisor/conf.d/supervisord.conf
31+
COPY ./conf/supervisord.dev.conf /etc/supervisor/conf.d/supervisord.conf
3132

3233
FROM base AS prod
33-
COPY supervisord.prod.conf /etc/supervisor/conf.d/supervisord.conf
34+
COPY ./conf/supervisord.prod.conf /etc/supervisor/conf.d/supervisord.conf

api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from biz.utils.reporter import Reporter
2222
from urllib.parse import urlparse
2323

24-
load_dotenv()
24+
load_dotenv("conf/.env")
2525
api_app = Flask(__name__)
2626

2727
PUSH_REVIEW_ENABLED = os.environ.get('PUSH_REVIEW_ENABLED', '0') == '1'
File renamed without changes.
File renamed without changes.

core/llm/client/base.py renamed to biz/llm/client/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from abc import abstractmethod
22
from typing import List, Dict, Optional
33

4-
from core.llm.types import NotGiven, NOT_GIVEN, CompletionMessage
4+
from biz.llm.types import NotGiven, NOT_GIVEN
55

66

77
class BaseClient:

core/llm/client/deepseek.py renamed to biz/llm/client/deepseek.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
import os
22
from typing import Dict, List, Optional
33

4-
from dotenv import load_dotenv
54
from openai import OpenAI
6-
from biz.utils.log import logger
75

8-
from core.llm.client.base import BaseClient
9-
from core.llm.types import NotGiven, NOT_GIVEN
6+
from biz.llm.client.base import BaseClient
7+
from biz.llm.types import NotGiven, NOT_GIVEN
8+
from biz.utils.log import logger
109

1110

1211
class DeepSeekClient(BaseClient):
1312
def __init__(self, api_key: str = None):
14-
if not os.getenv("DEEPSEEK_API_KEY"):
15-
load_dotenv()
1613
self.api_key = api_key or os.getenv("DEEPSEEK_API_KEY")
1714
self.base_url = os.getenv("DEEPSEEK_API_BASE_URL", "https://api.deepseek.com")
1815
if not self.api_key:

core/llm/client/ollama_client.py renamed to biz/llm/client/ollama_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
from ollama import ChatResponse
66
from ollama import Client
77

8-
from core.llm.client.base import BaseClient
9-
from core.llm.types import NotGiven, NOT_GIVEN
8+
from biz.llm.client.base import BaseClient
9+
from biz.llm.types import NotGiven, NOT_GIVEN
1010

1111

1212
class OllamaClient(BaseClient):

core/llm/client/openai.py renamed to biz/llm/client/openai.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
import os
22
from typing import Dict, List, Optional
33

4-
from dotenv import load_dotenv
54
from openai import OpenAI
65

7-
from core.llm.client.base import BaseClient
8-
from core.llm.types import NotGiven, NOT_GIVEN
6+
from biz.llm.client.base import BaseClient
7+
from biz.llm.types import NotGiven, NOT_GIVEN
98

109

1110
class OpenAIClient(BaseClient):
1211
def __init__(self, api_key: str = None):
13-
if not os.getenv("OPENAI_API_KEY"):
14-
load_dotenv()
1512
self.api_key = api_key or os.getenv("OPENAI_API_KEY")
1613
self.base_url = os.getenv("OPENAI_API_BASE_URL", "https://api.openai.com")
1714
if not self.api_key:

core/llm/client/zhipuai.py renamed to biz/llm/client/zhipuai.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
import os
22
from typing import Dict, List, Optional
33

4-
from dotenv import load_dotenv
54
from zhipuai import ZhipuAI
65

7-
from core.llm.client.base import BaseClient
8-
from core.llm.types import NotGiven, NOT_GIVEN
6+
from biz.llm.client.base import BaseClient
7+
from biz.llm.types import NotGiven, NOT_GIVEN
98

109

1110
class ZhipuAIClient(BaseClient):
1211
def __init__(self, api_key: str = None):
13-
if not os.getenv("ZHIPUAI_API_KEY"):
14-
load_dotenv()
1512
self.api_key = api_key or os.getenv("ZHIPUAI_API_KEY")
1613
if not self.api_key:
1714
raise ValueError("API key is required. Please provide it or set it in the environment variables.")

0 commit comments

Comments
 (0)