Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion cnllm/core/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def _load_class_config(cls) -> Dict[str, Any]:

config_path = os.path.join(
os.path.dirname(__file__),
"..", "..", "configs", cls.CONFIG_DIR, f"request_{cls.ADAPTER_NAME}.yaml"
"..", "configs", cls.CONFIG_DIR, f"request_{cls.ADAPTER_NAME}.yaml"
)
try:
import yaml
Expand Down
16 changes: 8 additions & 8 deletions cnllm/core/embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ def _find_config_for_model(model: str) -> tuple:
config_dir = adapter_name.replace("-embedding", "")
merged_path = os.path.join(
os.path.dirname(__file__),
"..", "..", "configs", config_dir,
"..", "configs", config_dir,
f"request_{config_dir}.yaml"
)
legacy_path = os.path.join(
os.path.dirname(__file__),
"..", "..", "configs", config_dir,
"..", "configs", config_dir,
f"request_embedding_{config_dir}.yaml"
)
config_path = merged_path if os.path.exists(merged_path) else legacy_path
Expand All @@ -49,12 +49,12 @@ def _find_config_for_model(model: str) -> tuple:
def _get_config_for_adapter(adapter_name: str) -> tuple:
merged_path = os.path.join(
os.path.dirname(__file__),
"..", "..", "configs", adapter_name,
"..", "configs", adapter_name,
f"request_{adapter_name}.yaml"
)
legacy_path = os.path.join(
os.path.dirname(__file__),
"..", "..", "configs", adapter_name,
"..", "configs", adapter_name,
f"request_embedding_{adapter_name}.yaml"
)
config_path = merged_path if os.path.exists(merged_path) else legacy_path
Expand All @@ -81,7 +81,7 @@ def _load_config(self) -> Dict[str, Any]:
import yaml
config_path = os.path.join(
os.path.dirname(__file__),
"..", "..", "configs", self.config_dir,
"..", "configs", self.config_dir,
f"response_embedding_{self.config_dir}.yaml"
)
try:
Expand Down Expand Up @@ -176,12 +176,12 @@ def _load_class_config(cls) -> Dict[str, Any]:

merged_path = os.path.join(
os.path.dirname(__file__),
"..", "..", "configs", cls.CONFIG_DIR,
"..", "configs", cls.CONFIG_DIR,
f"request_{cls.CONFIG_DIR}.yaml"
)
legacy_path = os.path.join(
os.path.dirname(__file__),
"..", "..", "configs", cls.CONFIG_DIR,
"..", "configs", cls.CONFIG_DIR,
f"request_embedding_{cls.CONFIG_DIR}.yaml"
)
config_path = merged_path if os.path.exists(merged_path) else legacy_path
Expand Down Expand Up @@ -229,7 +229,7 @@ def __init__(
if config_file is None:
merged_config = os.path.join(
os.path.dirname(__file__),
"..", "..", "configs", self.CONFIG_DIR,
"..", "configs", self.CONFIG_DIR,
f"request_{self.CONFIG_DIR}.yaml"
)
legacy_config = f"request_embedding_{self.CONFIG_DIR}.yaml"
Expand Down
2 changes: 1 addition & 1 deletion cnllm/core/responder.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(self, config_dir: str = None):
def _load_config(self) -> Dict[str, Any]:
config_path = os.path.join(
os.path.dirname(__file__),
"..", "..", "configs", self.config_dir, f"response_{self.config_dir}.yaml"
"..", "configs", self.config_dir, f"response_{self.config_dir}.yaml"
)
try:
import yaml
Expand Down
5 changes: 2 additions & 3 deletions cnllm/utils/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def _load_config(self) -> Dict[str, Any]:
config_path = os.path.join(
os.path.dirname(__file__),
"..",
"..",
"configs",
self.config_dir,
self.config_file
Expand Down Expand Up @@ -191,7 +190,7 @@ def detect_protocol(base_url: str, config_dir: str) -> str:
"""
import os, yaml
# 查找 YAML 文件
base_path = os.path.join(os.path.dirname(__file__), "..", "..", "configs", config_dir)
base_path = os.path.join(os.path.dirname(__file__), "..", "configs", config_dir)
for candidate in [f"request_{config_dir}.yaml", f"request_{config_dir}.yml"]:
yaml_path = os.path.join(base_path, candidate)
if os.path.exists(yaml_path):
Expand Down Expand Up @@ -228,7 +227,7 @@ def has_protocol_config(config_dir: str) -> bool:
其他无多协议的厂商返回 False,避免不必要的 protocol 检测。
"""
import os, yaml
base_path = os.path.join(os.path.dirname(__file__), "..", "..", "configs", config_dir)
base_path = os.path.join(os.path.dirname(__file__), "..", "configs", config_dir)
for candidate in [f"request_{config_dir}.yaml", f"request_{config_dir}.yml"]:
yaml_path = os.path.join(base_path, candidate)
if os.path.exists(yaml_path):
Expand Down
1 change: 0 additions & 1 deletion cnllm/utils/vendor_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ def _load_config(self) -> Dict[str, Any]:
config_path = os.path.join(
os.path.dirname(__file__),
"..",
"..",
"configs",
self.config_dir,
f"request_{self.config_dir}.yaml"
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,6 @@ asyncio_mode = "auto"
[tool.setuptools.packages.find]
where = ["."]
include = ["cnllm*"]

[tool.setuptools]
include-package-data = true
Loading