fix: model过滤后为空时退回到不过滤,避免单模型ppid定价变空
This commit is contained in:
parent
2fcd33cdba
commit
d7d02ccb6b
@ -920,18 +920,18 @@ async def get_pricing_display(ppid, model=None):
|
||||
items.append(item)
|
||||
|
||||
# 按模型过滤:只返回匹配该模型的定价项
|
||||
# 如果过滤后为空(单模型ppid没有model字段),退回不过滤
|
||||
if model:
|
||||
filtered_items = []
|
||||
for item in items:
|
||||
item_model = None
|
||||
# 从 filters dict 中取 model
|
||||
if item.get('filters') and isinstance(item['filters'], dict):
|
||||
item_model = item['filters'].get('model')
|
||||
# 从 filter_labels 中取(用 key 名"模型"查找)
|
||||
if not item_model and item.get('filter_labels'):
|
||||
item_model = item['filter_labels'].get('模型')
|
||||
if item_model == model:
|
||||
filtered_items.append(item)
|
||||
if filtered_items:
|
||||
items = filtered_items
|
||||
|
||||
# 生成可读价格表
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user