shenbing commited on
Commit
6c86791
·
verified ·
1 Parent(s): 7bc5824

Upload 5 files

Browse files
Files changed (2) hide show
  1. common/constants.go +4 -3
  2. common/utils.go +42 -0
common/constants.go CHANGED
@@ -3,16 +3,17 @@ package common
3
  import "time"
4
 
5
  var StartTime = time.Now().Unix() // unit: second
6
- var Version = "v1.5.4" // this hard coding will be replaced automatically when building, no need to manually change
7
 
8
  var DefaultOpenaiModelList = []string{
9
  "gpt-4o",
10
  "gpt-4o-mini",
11
- "o1-preview",
12
  "claude-3-5-sonnet",
13
  "claude-3-5-haiku",
14
  "gemini-1.5-pro",
15
  "gemini-1.5-flash",
 
16
 
17
  "flux",
18
  "flux-speed",
@@ -25,7 +26,7 @@ var DefaultOpenaiModelList = []string{
25
  var TextModelList = []string{
26
  "gpt-4o",
27
  "gpt-4o-mini",
28
- "o1-preview",
29
  "claude-3-5-sonnet",
30
  "claude-3-5-haiku",
31
  "gemini-1.5-pro",
 
3
  import "time"
4
 
5
  var StartTime = time.Now().Unix() // unit: second
6
+ var Version = "v1.7.4" // this hard coding will be replaced automatically when building, no need to manually change
7
 
8
  var DefaultOpenaiModelList = []string{
9
  "gpt-4o",
10
  "gpt-4o-mini",
11
+ "o1",
12
  "claude-3-5-sonnet",
13
  "claude-3-5-haiku",
14
  "gemini-1.5-pro",
15
  "gemini-1.5-flash",
16
+ "deep-seek-v3",
17
 
18
  "flux",
19
  "flux-speed",
 
26
  var TextModelList = []string{
27
  "gpt-4o",
28
  "gpt-4o-mini",
29
+ "o1",
30
  "claude-3-5-sonnet",
31
  "claude-3-5-haiku",
32
  "gemini-1.5-pro",
common/utils.go CHANGED
@@ -165,3 +165,45 @@ func IsRateLimit(data string) bool {
165
 
166
  return false
167
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
 
166
  return false
167
  }
168
+
169
+ func IsServerError(data string) bool {
170
+ if data == "Internal Server Error" {
171
+ return true
172
+ }
173
+
174
+ return false
175
+ }
176
+
177
+ func IsServiceUnavailablePage(data string) bool {
178
+ // 检查基本的 HTML 结构
179
+ htmlPattern := `^<!doctype html><html.*?><head>.*?</head><body.*?>.*?</body></html>`
180
+
181
+ // 检查 Service Unavailable 页面特征
182
+ suPatterns := []string{
183
+ `<title>Genspark</title>`, // 标题特征
184
+ `Service\s+Unavailable`, // 错误信息
185
+ `class="bb".*?class="s1".*?class="s2".*?class="s3"`, // 特征性类名结构
186
+ `genspark_logo\.png`, // Logo 图片
187
+ `gensparkpublicblob-cdn.*?\.azurefd\.net`, // CDN 域名
188
+ `<div class="tt">Service Unavailable</div>`, // 错误信息容器
189
+ }
190
+
191
+ // 首先检查整体 HTML 结构
192
+ matched, _ := regexp.MatchString(htmlPattern, strings.TrimSpace(data))
193
+ if !matched {
194
+ return false
195
+ }
196
+
197
+ // 检查特征模式,至少匹配其中的 3 个才认为是目标页面
198
+ matchCount := 0
199
+ for _, pattern := range suPatterns {
200
+ if matched, _ := regexp.MatchString(pattern, data); matched {
201
+ matchCount++
202
+ }
203
+ }
204
+
205
+ return matchCount >= 3
206
+ }
207
+
208
+ //<!doctype html><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><title>Genspark</title><link rel="icon" href="https://gensparkpublicblob-cdn-e6g4btgjavb5a7gh.z03.azurefd.net/user-upload-image/manual/favicon.ico"><style>body,html{margin:0;padding:0;font-family:Arial}.bb{width:100vw;height:100vh;position:absolute;overflow:hidden}.logo img{margin:20px 0 0 24px;height:24px}.iw{display:flex;flex-direction:column;height:100vh;width:100%}.s1{position:absolute;top:0;left:0;margin-top:-5%;margin-left:15%;width:289px;height:289px;border-radius:289px;opacity:.6;background:radial-gradient(55.64% 49.84%,#2c10d6 0,rgba(44,16,214,.36) 100%);filter:blur(120px)}.s2{position:absolute;top:0;left:0;margin-top:10%;margin-left:50%;width:204.845px;height:204.845px;transform:rotate(-131.346deg);flex-shrink:0;background:radial-gradient(55.64% 49.84%,#7fd1ff 0,rgba(44,16,214,.36) 100%);filter:blur(120px)}.s3{position:absolute;bottom:0;right:0;margin-bottom:10%;margin-right:10%;width:251px;height:251px;border-radius:289.093px;background:radial-gradient(88.27% 88.27% at 90.98% 61.04%,#ce7fff 0,#ffe4af 100%);filter:blur(120px)}.cc{display:flex;justify-content:center;align-items:center;height:100%;width:100%}.hh{align-items:center;display:flex;width:100vw}.dd{margin-top:-200px}.tt{color:#000;text-align:center;font-size:40px;font-style:normal;font-weight:700}@media (max-width:800px){.tt{font-size:30px}}</style></head><body><div class="bb"><div class="s1"></div><div class="s2"></div><div class="s3"></div></div><div class="iw"><div class="hh"><div class="logo"><img src="https://gensparkpublicblob-cdn-e6g4btgjavb5a7gh.z03.azurefd.net/user-upload-image/manual/genspark_logo.png" alt="logo"></div></div><div class="cc"><div class="dd"><div class="tt">Service Unavailable</div></div></div></div></body></html>
209
+ //<!doctype html><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><title>Genspark</title><link rel="icon" href="https://gensparkpublicblob-cdn-e6g4btgjavb5a7gh.z03.azurefd.net/user-upload-image/manual/favicon.ico"><style>body,html{margin:0;padding:0;font-family:Arial}.bb{width:100vw;height:100vh;position:absolute;overflow:hidden}.logo img{margin:20px 0 0 24px;height:24px}.iw{display:flex;flex-direction:column;height:100vh;width:100%!}(MISSING).s1{position:absolute;top:0;left:0;margin-top:-5%!;(MISSING)margin-left:15%!;(MISSING)width:289px;height:289px;border-radius:289px;opacity:.6;background:radial-gradient(55.64%,#2c10d6 0,rgba(44,16,214,.36) 100%!)(MISSING);filter:blur(120px)}.s2{position:absolute;top:0;left:0;margin-top:10%!;(MISSING)margin-left:50%!;(MISSING)width:204.845px;height:204.845px;transform:rotate(-131.346deg);flex-shrink:0;background:radial-gradient(55.64%,#7fd1ff 0,rgba(44,16,214,.36) 100%!)(MISSING);filter:blur(120px)}.s3{position:absolute;bottom:0;right:0;margin-bottom:10%!;(MISSING)margin-right:10%!;(MISSING)width:251px;height:251px;border-radius:289.093px;background:radial-gradient(88.27% at 90.98%,#ce7fff 0,#ffe4af 100%!)(MISSING);filter:blur(120px)}.cc{display:flex;justify-content:center;align-items:center;height:100%!;(MISSING)width:100%!}(MISSING).hh{align-items:center;display:flex;width:100vw}.dd{margin-top:-200px}.tt{color:#000;text-align:center;font-size:40px;font-style:normal;font-weight:700}@media (max-width:800px){.tt{font-size:30px}}</style></head><body><div class="bb"><div class="s1"></div><div class="s2"></div><div class="s3"></div></div><div class="iw"><div class="hh"><div class="logo"><img src="https://gensparkpublicblob-cdn-e6g4btgjavb5a7gh.z03.azurefd.net/user-upload-image/manual/genspark_logo.png" alt="logo"></div></div><div class="cc"><div class="dd"><div class="tt">Service Unavailable</div></div></div></div></body></html>