sin30 commited on
Commit
6275b67
·
verified ·
1 Parent(s): e33079c

Upload n_mongo.py

Browse files
Files changed (1) hide show
  1. n_mongo.py +71 -42
n_mongo.py CHANGED
@@ -25,26 +25,26 @@ data = doc["data"]
25
 
26
  data.append({
27
  'stream_selected': 0,
28
- 'label': 'us.anthropic.claude-3-7-sonnet-20250219-v1:0',
29
- 'value': 'us.anthropic.claude-3-7-sonnet-20250219-v1:0',
30
  'wechat_selected': 0,
31
  'wechat_label': 0,
32
  'selected': 0,
33
  'max_tokens': 4000,
34
- 'is_think': 0,
35
  'web_label': 0,
36
  'stream_label': 0
37
  })
38
 
39
  data.append({
40
  'stream_selected': 0,
41
- 'label': 'us.anthropic.claude-sonnet-4-20250514-v1:0',
42
- 'value': 'us.anthropic.claude-sonnet-4-20250514-v1:0',
43
  'wechat_selected': 0,
44
  'wechat_label': 0,
45
  'selected': 0,
46
  'max_tokens': 4000,
47
- 'is_think': 0,
48
  'web_label': 0,
49
  'stream_label': 0
50
  })
@@ -52,8 +52,8 @@ data.append({
52
 
53
  data.append({
54
  'stream_selected': 0,
55
- 'label': 'qwen-turbo',
56
- 'value': 'qwen-turbo',
57
  'wechat_selected': 0,
58
  'wechat_label': 0,
59
  'selected': 0,
@@ -63,51 +63,80 @@ data.append({
63
  'stream_label': 0
64
  })
65
 
 
 
 
 
 
 
 
 
 
 
 
 
66
 
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
 
69
- # # 2. 在本地 dict 里插入/修改
70
- # data["us.anthropic.claude-3-7-sonnet-20250219-v1:0"] = {
71
- # "completion_price": 0.0006,
72
- # "prompt_price": 0.003,
73
- # "currency": "$"
74
- # }
 
 
 
 
 
 
75
 
76
- # # 2. 在本地 dict 里插入/修改
77
- # data["us.anthropic.claude-sonnet-4-20250514-v1:0"] = {
78
- # "completion_price": 0.0006,
79
- # "prompt_price": 0.003,
80
- # "currency": "$"
81
- # }
82
 
83
- # # 2. 在本地 dict 里插入/修改
84
- # data["qwen-turbo"] = {
85
- # "completion_price": 0.0006,
86
- # "prompt_price": 0.0003,
87
- # "currency": "¥"
88
- # }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
 
90
  # 3. 一次性把整个 data 写回去
91
  result = collection.update_one(
92
- {"name": "txt2txt_price_config"},
93
  {"$set": {"data": data}}
94
  )
95
  print(f"matched={result.matched_count}, modified={result.modified_count}")
96
 
97
- # service_name = "us.anthropic.claude-3-7-sonnet-20250219-v1:0"
98
- # service_data = {
99
- # "completion_price": 0.015,
100
- # "prompt_price": 0.003,
101
- # "currency": "$"
102
- # }
103
-
104
- # result = collection.update_one(
105
- # {"name": "txt2txt_price_config"},
106
- # {"$set": {f"data.{service_name}": service_data}}
107
- # )
108
-
109
- # print(f"matched={result.matched_count}, modified={result.modified_count}")
110
-
111
 
112
  query = {"name": "txt2txt_config"}
113
  projection = {"_id": 0, "data": 1}
@@ -119,7 +148,7 @@ if doc:
119
  data_value = doc.get("data")
120
  print(data_value)
121
  else:
122
- print("未找到 name 等于 txt2txt_price_config 的记录")
123
 
124
 
125
  # 查询单条文档
 
25
 
26
  data.append({
27
  'stream_selected': 0,
28
+ 'label': 'gpt-5',
29
+ 'value': 'gpt-5',
30
  'wechat_selected': 0,
31
  'wechat_label': 0,
32
  'selected': 0,
33
  'max_tokens': 4000,
34
+ 'is_think': 1,
35
  'web_label': 0,
36
  'stream_label': 0
37
  })
38
 
39
  data.append({
40
  'stream_selected': 0,
41
+ 'label': 'gpt-5-chat',
42
+ 'value': 'gpt-5-chat',
43
  'wechat_selected': 0,
44
  'wechat_label': 0,
45
  'selected': 0,
46
  'max_tokens': 4000,
47
+ 'is_think': 1,
48
  'web_label': 0,
49
  'stream_label': 0
50
  })
 
52
 
53
  data.append({
54
  'stream_selected': 0,
55
+ 'label': 'gpt-5-nano',
56
+ 'value': 'gpt-5-nano',
57
  'wechat_selected': 0,
58
  'wechat_label': 0,
59
  'selected': 0,
 
63
  'stream_label': 0
64
  })
65
 
66
+ data.append({
67
+ 'stream_selected': 0,
68
+ 'label': 'gpt-5-mini',
69
+ 'value': 'gpt-5-mini',
70
+ 'wechat_selected': 0,
71
+ 'wechat_label': 0,
72
+ 'selected': 0,
73
+ 'max_tokens': 4000,
74
+ 'is_think': 1,
75
+ 'web_label': 0,
76
+ 'stream_label': 0
77
+ })
78
 
79
+ data.append({
80
+ 'stream_selected': 0,
81
+ 'label': 'gpt-4.1',
82
+ 'value': 'gpt-4.1',
83
+ 'wechat_selected': 0,
84
+ 'wechat_label': 0,
85
+ 'selected': 0,
86
+ 'max_tokens': 4000,
87
+ 'is_think': 0,
88
+ 'web_label': 0,
89
+ 'stream_label': 0
90
+ })
91
 
92
 
93
+ data.append({
94
+ 'stream_selected': 0,
95
+ 'label': 'gpt-4.1-mini',
96
+ 'value': 'gpt-4.1-mini',
97
+ 'wechat_selected': 0,
98
+ 'wechat_label': 0,
99
+ 'selected': 0,
100
+ 'max_tokens': 4000,
101
+ 'is_think': 0,
102
+ 'web_label': 0,
103
+ 'stream_label': 0
104
+ })
105
 
 
 
 
 
 
 
106
 
107
+ data.append({
108
+ 'stream_selected': 0,
109
+ 'label': 'gpt-4.1-nano',
110
+ 'value': 'gpt-4.1-nano',
111
+ 'wechat_selected': 0,
112
+ 'wechat_label': 0,
113
+ 'selected': 0,
114
+ 'max_tokens': 4000,
115
+ 'is_think': 0,
116
+ 'web_label': 0,
117
+ 'stream_label': 0
118
+ })
119
+
120
+ data.append({
121
+ 'stream_selected': 0,
122
+ 'label': 'o3',
123
+ 'value': 'o3',
124
+ 'wechat_selected': 0,
125
+ 'wechat_label': 0,
126
+ 'selected': 0,
127
+ 'max_tokens': 4000,
128
+ 'is_think': 1,
129
+ 'web_label': 0,
130
+ 'stream_label': 0
131
+ })
132
 
133
  # 3. 一次性把整个 data 写回去
134
  result = collection.update_one(
135
+ {"name": "txt2txt_config"},
136
  {"$set": {"data": data}}
137
  )
138
  print(f"matched={result.matched_count}, modified={result.modified_count}")
139
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
 
141
  query = {"name": "txt2txt_config"}
142
  projection = {"_id": 0, "data": 1}
 
148
  data_value = doc.get("data")
149
  print(data_value)
150
  else:
151
+ print("未找到 name 等于 txt2txt_config 的记录")
152
 
153
 
154
  # 查询单条文档