sin30 commited on
Commit
e33079c
·
verified ·
1 Parent(s): 83ad0de

Upload mongo.py

Browse files
Files changed (1) hide show
  1. mongo.py +40 -30
mongo.py CHANGED
@@ -23,14 +23,49 @@ if not doc:
23
 
24
  data = doc["data"]
25
 
26
- # 2. 在本地 dict 里插入/修改
27
- data["us.anthropic.claude-3-7-sonnet-20250219-v1:0"] = {
28
- "completion_price": 0.015,
29
- "prompt_price": 0.003,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  "currency": "$"
31
  }
32
 
33
- del data["us"]
34
 
35
  # 3. 一次性把整个 data 写回去
36
  result = collection.update_one(
@@ -39,20 +74,6 @@ result = collection.update_one(
39
  )
40
  print(f"matched={result.matched_count}, modified={result.modified_count}")
41
 
42
- # service_name = "us.anthropic.claude-3-7-sonnet-20250219-v1:0"
43
- # service_data = {
44
- # "completion_price": 0.015,
45
- # "prompt_price": 0.003,
46
- # "currency": "$"
47
- # }
48
-
49
- # result = collection.update_one(
50
- # {"name": "txt2txt_price_config"},
51
- # {"$set": {f"data.{service_name}": service_data}}
52
- # )
53
-
54
- # print(f"matched={result.matched_count}, modified={result.modified_count}")
55
-
56
 
57
  query = {"name": "txt2txt_price_config"}
58
  projection = {"_id": 0, "data": 1}
@@ -66,14 +87,3 @@ if doc:
66
  else:
67
  print("未找到 name 等于 txt2txt_price_config 的记录")
68
 
69
-
70
- # 查询单条文档
71
- # doc = collection.find_one(query, projection)
72
-
73
- # db = col.database # 或者直接用 client["dashboard"]
74
-
75
- # # 列出所有集合名
76
- # collections = db.list_collection_names()
77
- # print("当前 database 下的集合:", collections)
78
-
79
- # ['mp_collection', 'system.profile', 'mtxx_odz_aimr_im_chat_order_label_aggregate', 'xx_expose_history', 'aibeauty_trigger', 'mtxx_odz_aimr_im_chat_order', 'my_music_history', 'aibeauty_data_beta', 'my_music_history_count14', 'xx_area_mapping', 'aibeauty_trigger_beta', 'aibeauty_feedback', 'counters', 'xx_music_history', 'aibeauty_directive_beta', 'gd_history', 'message_spark_list_beta', 'my_expose', 'aibeauty_directive', 'xx_material_history', 'message_tongyi_list', 'aibeauty_im_msg', 'xx_formula_save_top100', 'aibeauty_title_stat', 'aibeauty_data', 'config', 'message_wenxin_list_beta', 'im_chat_msg_type', 'mp_neg_feedback', 'my_click', 'my_material_use_info', 'message_list_beta', 'message_pangu_list', 'aibeauty_data_history', 'my_search_history', 'mp_live', 'aibeauty_feedback_beta', 'aibeauty_top_data', 'message_wenxin_list', 'mp_expose', 'aibeauty_title_beta', 'aibeauty_data_history_beta', 'mtxx_odz_aimr_im_chat_order_label', 'related_history', 'xx_new_user', 'mht_rec_path', 'xx_feed_count', 'sdk_adz_aigc_chatgpt_info', 'aibeauty_top_data_gid_room_id', 'video_4k_transcoder', 'my_material_info', 'xx_music_material_category', 'mp_click', 'my_banner_history', 'webui_task_beta', 'config_beta', 'mht_dynamic_info', 'aibeauty_top_data_prompt_roomlist', 'my_search_history_count14', 'my_material_info_30', 'webui_record_beta', 'my_material_history', 'message_list', 'my_tmpl_history', 'aibeauty_title_stat_beta', 'message_pangu_list_beta', 'xx_dislike', 'my_music_history_count30', 'my_recommend_view', 'nlp_timeliness', 'blackflow_history', 'aibeauty_title', 'aibeauty_top_data_beta', 'message_spark_list', 'message_tongyi_list_beta', 'click_history']
 
23
 
24
  data = doc["data"]
25
 
26
+
27
+ data["gpt-4.1"] = {
28
+ "completion_price": 0.008,
29
+ "prompt_price": 0.002,
30
+ "currency": "$"
31
+ }
32
+
33
+ data["gpt-4.1-mini"] = {
34
+ "completion_price": 0.0016,
35
+ "prompt_price": 0.0004,
36
+ "currency": "$"
37
+ }
38
+
39
+ data["gpt-4.1-nano"] = {
40
+ "completion_price": 0.0004,
41
+ "prompt_price": 0.0001,
42
+ "currency": "$"
43
+ }
44
+
45
+ data["gpt-5"] = {
46
+ "completion_price": 0.01,
47
+ "prompt_price": 0.00125,
48
+ "currency": "$"
49
+ }
50
+
51
+ data["gpt-5-chat"] = {
52
+ "completion_price": 0.01,
53
+ "prompt_price": 0.00125,
54
+ "currency": "$"
55
+ }
56
+
57
+ data["gpt-5-nano"] = {
58
+ "completion_price": 0.0004,
59
+ "prompt_price": 0.00005,
60
+ "currency": "$"
61
+ }
62
+
63
+ data["gpt-5-mini"] = {
64
+ "completion_price": 0.002,
65
+ "prompt_price": 0.00025,
66
  "currency": "$"
67
  }
68
 
 
69
 
70
  # 3. 一次性把整个 data 写回去
71
  result = collection.update_one(
 
74
  )
75
  print(f"matched={result.matched_count}, modified={result.modified_count}")
76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
 
78
  query = {"name": "txt2txt_price_config"}
79
  projection = {"_id": 0, "data": 1}
 
87
  else:
88
  print("未找到 name 等于 txt2txt_price_config 的记录")
89