yangtb24 commited on
Commit
907f3c3
·
verified ·
1 Parent(s): 5e02bab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -41
app.py CHANGED
@@ -165,47 +165,6 @@ def process_key(key):
165
  else:
166
  return "valid"
167
 
168
- def get_all_models(api_key, sub_type):
169
- """
170
- 获取所有模型列表。
171
- """
172
- headers = {
173
- "Authorization": f"Bearer {api_key}",
174
- "Content-Type": "application/json"
175
- }
176
- try:
177
- response = requests.get(
178
- MODELS_ENDPOINT,
179
- headers=headers,
180
- params={"sub_type": sub_type}
181
- )
182
- response.raise_for_status()
183
- data = response.json()
184
- if (
185
- isinstance(data, dict) and
186
- 'data' in data and
187
- isinstance(data['data'], list)
188
- ):
189
- return [
190
- model.get("id") for model in data["data"]
191
- if isinstance(model, dict) and "id" in model
192
- ]
193
- else:
194
- logging.error("获取模型列表失败:响应数据格式不正确")
195
- return []
196
- except requests.exceptions.RequestException as e:
197
- logging.error(
198
- f"获取模型列表失败,"
199
- f"API Key:{api_key},错误信息:{e}"
200
- )
201
- return []
202
- except (KeyError, TypeError) as e:
203
- logging.error(
204
- f"解析模型列表失败,"
205
- f"API Key:{api_key},错误信息:{e}"
206
- )
207
- return []
208
-
209
  def select_key(model_name):
210
  """
211
  根据请求类型和模型名称选择合适的 KEY,
 
165
  else:
166
  return "valid"
167
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  def select_key(model_name):
169
  """
170
  根据请求类型和模型名称选择合适的 KEY,