返回提交历史
Modified
g4f/client/helper.py
+18
-1
XFEstudio/gpt4free
Update helper.py
ecc47488
代码差异
1 个文件
+18
-1
@@ -13,4 +13,21 @@ def read_json(text: str) -> dict:
13
13
match = re.search(r"```(json|)\n(?P<code>[\S\s]+?)\n```", text)
14
14
if match:
15
15
return match.group("code")
16
return text
16
return text
17
18
def find_stop(stop, content: str, chunk: str):
19
first = -1
20
word = None
21
if stop is not None:
22
for word in list(stop):
23
first = content.find(word)
24
if first != -1:
25
content = content[:first]
26
break
27
if stream and first != -1:
28
first = chunk.find(word)
29
if first != -1:
30
chunk = chunk[:first]
31
else:
32
first = 0
33
return first, content, chunk