File size: 4,292 Bytes
aedcabb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
"""
Model Resolver Module for DeepSeek Server.
Handles auto-selection of default model (DeepSeek-V3 Standard) when not specified.
"""

DEFAULT_MODEL_NAME = "DeepSeek-V3 Standard"

MODEL_PRESETS = {
    # Default: DeepSeek-V3 Standard
    "deepseek-v3 standard": {
        "name": "DeepSeek-V3 Standard",
        "model_type": "expert",
        "thinking_enabled": False,
        "search_enabled": False,
        "description": "DeepSeek-V3 Standard (Default)"
    },
    "deepseek-v3": {
        "name": "DeepSeek-V3 Standard",
        "model_type": "expert",
        "thinking_enabled": False,
        "search_enabled": False,
        "description": "DeepSeek-V3 Standard"
    },
    "default": {
        "name": "DeepSeek-V3 Standard",
        "model_type": "expert",
        "thinking_enabled": False,
        "search_enabled": False,
        "description": "DeepSeek-V3 Standard"
    },
    # DeepSeek-R1 Reasoning
    "deepseek-r1": {
        "name": "DeepSeek-R1",
        "model_type": "default",
        "thinking_enabled": True,
        "search_enabled": False,
        "description": "DeepSeek-R1 Reasoning Mode"
    },
    "reasoner": {
        "name": "DeepSeek-R1",
        "model_type": "default",
        "thinking_enabled": True,
        "search_enabled": False,
        "description": "DeepSeek-R1 Reasoning Mode"
    },
    # DeepSeek-V3 + R1 Expert Thinking
    "deepseek-v3-r1": {
        "name": "DeepSeek-V3 + R1 Thinking",
        "model_type": "expert",
        "thinking_enabled": True,
        "search_enabled": False,
        "description": "DeepSeek-V3 + R1 Thinking Mode"
    },
    # Web Search Mode
    "deepseek-search": {
        "name": "DeepSeek Web Search",
        "model_type": None,
        "thinking_enabled": False,
        "search_enabled": True,
        "description": "DeepSeek Web Search Mode"
    },
    # DeepSeek Vision / Multimodal (DeepSeek-VL & Janus-Pro)
    "deepseek-vision": {
        "name": "DeepSeek Vision (DeepSeek-VL / Janus)",
        "model_type": "expert",
        "thinking_enabled": False,
        "search_enabled": False,
        "description": "DeepSeek Vision & Multimodal Mode (DeepSeek-VL / Janus-Pro)"
    },
    "deepseek-vl": {
        "name": "DeepSeek Vision (DeepSeek-VL / Janus)",
        "model_type": "expert",
        "thinking_enabled": False,
        "search_enabled": False,
        "description": "DeepSeek Vision & Multimodal Mode (DeepSeek-VL / Janus-Pro)"
    },
    "deepseek-janus": {
        "name": "DeepSeek Vision (DeepSeek-VL / Janus)",
        "model_type": "expert",
        "thinking_enabled": False,
        "search_enabled": False,
        "description": "DeepSeek Vision & Multimodal Mode (DeepSeek-VL / Janus-Pro)"
    },
    "deepseek-janus-pro": {
        "name": "DeepSeek Vision (DeepSeek-VL / Janus)",
        "model_type": "expert",
        "thinking_enabled": False,
        "search_enabled": False,
        "description": "DeepSeek Vision & Multimodal Mode (DeepSeek-VL / Janus-Pro)"
    }
}

def resolve_model(requested_model: str = None) -> dict:
    """
    Resolves incoming model request.
    If requested_model is empty/None/unspecified, defaults to DeepSeek-V3 Standard.
    """
    if not requested_model or not str(requested_model).strip():
        preset_key = "deepseek-v3 standard"
        was_default = True
    else:
        name_clean = str(requested_model).lower().strip()
        was_default = False
        
        if name_clean in MODEL_PRESETS:
            preset_key = name_clean
        elif "vision" in name_clean or "vl" in name_clean or "janus" in name_clean:
            preset_key = "deepseek-vision"
        elif "r1" in name_clean or "reason" in name_clean or "thinking" in name_clean:
            if "expert" in name_clean or "v3" in name_clean:
                preset_key = "deepseek-v3-r1"
            else:
                preset_key = "deepseek-r1"
        elif "search" in name_clean or "web" in name_clean:
            preset_key = "deepseek-search"
        else:
            preset_key = "deepseek-v3 standard"
            was_default = True

    config = MODEL_PRESETS[preset_key].copy()
    config["was_auto_selected"] = was_default
    config["requested_model"] = requested_model if requested_model else DEFAULT_MODEL_NAME
    return config