File tree Expand file tree Collapse file tree 3 files changed +21
-14
lines changed
Expand file tree Collapse file tree 3 files changed +21
-14
lines changed Original file line number Diff line number Diff line change @@ -25,4 +25,4 @@ resource:
2525 model :
2626 enabled : false
2727type : plugin
28- version : 0.2.5
28+ version : 0.3.0
Original file line number Diff line number Diff line change 55- claude-opus-4-1-20250805
66- claude-opus-4-20250514
77- claude-sonnet-4-20250514
8- - claude-3-5-haiku-20241022
9- - claude-3-5-sonnet-20241022
10- - claude-3-5-sonnet-20240620
11- - claude-3-7-sonnet-20250219
12- - claude-3-haiku-20240307
13- - claude-3-opus-20240229
14- - claude-3-sonnet-20240229
8+ - claude-3-7-sonnet-20250219
Original file line number Diff line number Diff line change 22from pathlib import Path
33
44import pytest
5+ import yaml
56
67from dify_plugin .config .integration_config import IntegrationConfig
78from dify_plugin .core .entities .plugin .request import (
1516
1617
1718def get_all_models () -> list [str ]:
18- """Discover all model names from models/llm/* .yaml files ."""
19+ """Read model names from models/llm/_position .yaml."""
1920 models_dir = Path (__file__ ).parent .parent / "models" / "llm"
21+ position_file = models_dir / "_position.yaml"
22+ if not position_file .exists ():
23+ raise FileNotFoundError (f"Missing model position file: { position_file } " )
24+
25+ try :
26+ data = yaml .safe_load (position_file .read_text (encoding = "utf-8" ))
27+ except yaml .YAMLError as exc :
28+ raise ValueError (f"Invalid YAML in { position_file } " ) from exc
29+
30+ if data is None :
31+ return []
32+ if not isinstance (data , list ):
33+ raise ValueError (f"Expected a YAML list in { position_file } " )
34+
2035 models : list [str ] = []
21- for yaml_file in models_dir .glob ("*.yaml" ):
22- if yaml_file .name .startswith ("_" ):
23- continue
24- model_name = yaml_file .stem
25- models .append (model_name )
36+ for item in data :
37+ if isinstance (item , str ) and item .strip ():
38+ models .append (item .strip ())
2639 return models
2740
2841
You can’t perform that action at this time.
0 commit comments