Your Name commited on
Commit
d98d0a2
1 Parent(s): ee94fa6

移动函数位置

Browse files
Files changed (1) hide show
  1. request_llm/bridge_newbing.py +13 -14
request_llm/bridge_newbing.py CHANGED
@@ -21,6 +21,19 @@ import threading
21
  from toolbox import update_ui, get_conf, trimmed_format_exc
22
  from multiprocessing import Process, Pipe
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  class NewBingHandle(Process):
25
  def __init__(self):
26
  super().__init__(daemon=True)
@@ -159,20 +172,6 @@ class NewBingHandle(Process):
159
  else:
160
  yield res # newbing回复的片段
161
  self.threadLock.release()
162
-
163
-
164
- def preprocess_newbing_out(s):
165
- pattern = r'\^(\d+)\^' # 匹配^数字^
166
- sub = lambda m: '\['+m.group(1)+'\]' # 将匹配到的数字作为替换值
167
- result = re.sub(pattern, sub, s) # 替换操作
168
- if '[1]' in result:
169
- result += '\n\n```\n' + "\n".join([r for r in result.split('\n') if r.startswith('[')]) + '\n```\n'
170
- return result
171
-
172
- def preprocess_newbing_out_simple(result):
173
- if '[1]' in result:
174
- result += '\n\n```\n' + "\n".join([r for r in result.split('\n') if r.startswith('[')]) + '\n```\n'
175
- return result
176
 
177
 
178
  """
 
21
  from toolbox import update_ui, get_conf, trimmed_format_exc
22
  from multiprocessing import Process, Pipe
23
 
24
+ def preprocess_newbing_out(s):
25
+ pattern = r'\^(\d+)\^' # 匹配^数字^
26
+ sub = lambda m: '\['+m.group(1)+'\]' # 将匹配到的数字作为替换值
27
+ result = re.sub(pattern, sub, s) # 替换操作
28
+ if '[1]' in result:
29
+ result += '\n\n```\n' + "\n".join([r for r in result.split('\n') if r.startswith('[')]) + '\n```\n'
30
+ return result
31
+
32
+ def preprocess_newbing_out_simple(result):
33
+ if '[1]' in result:
34
+ result += '\n\n```\n' + "\n".join([r for r in result.split('\n') if r.startswith('[')]) + '\n```\n'
35
+ return result
36
+
37
  class NewBingHandle(Process):
38
  def __init__(self):
39
  super().__init__(daemon=True)
 
172
  else:
173
  yield res # newbing回复的片段
174
  self.threadLock.release()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
 
176
 
177
  """