// Werkzeug Debugger
JSONDecodeError
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last)
-
File “F:\project\wxgzh\venv\lib\site-packages\requests\models.py”
IT之家 8 月 10 日消息,近日,清华大学新闻与传播学院教授、博士生导师沈阳所在团队发布了《大语言模型综合性能评估报告》(下文简称“报告”),报告显示总得分率 GPT-4 第一,百度文心一言在三大维度 20 项指标中综合评分国内第一,超越 ChatGPT,其中中文语义理解排名第一,部分中文能力超越 GPT-4。
<!doctype html>
<html lang=en>
<head>
<title>requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
// Werkzeug Debugger</title>
<link rel=”stylesheet” href=”?__debugger__=yes&cmd=resource&f=style.css”>
<link rel=”shortcut icon”
href=”?__debugger__=yes&cmd=resource&f=console.png”>
<script src=”?__debugger__=yes&cmd=resource&f=debugger.js”></script>
<script>
var CONSOLE_MODE = false,
EVALEX = true,
EVALEX_TRUSTED = false,
SECRET = “uImqR9BO9WQOrgY4YnuS”;
</script>
</head>
<body style=”background-color: #fff”>
<div class=”debugger”>
<h1>JSONDecodeError</h1>
<div class=”detail”>
<p class=”errormsg”>requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
</p>
</div>
<h2 class=”traceback”>Traceback <em>(most recent call last)</em></h2>
<div class=”traceback”>
<h3></h3>
<ul><li><div class=”frame” id=”frame-2553431310848″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\models.py”</cite>,
line <em class=”line”>971</em>,
in <code class=”function”>json</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”> </span>pass</pre>
<pre class=”line before”><span class=”ws”> </span>except JSONDecodeError as e:</pre>
<pre class=”line before”><span class=”ws”> </span>raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)</pre>
<pre class=”line before”><span class=”ws”></span> </pre>
<pre class=”line before”><span class=”ws”> </span>try:</pre>
<pre class=”line current”><span class=”ws”> </span>return complexjson.loads(self.text, **kwargs)</pre>
<pre class=”line after”><span class=”ws”> </span>except JSONDecodeError as e:</pre>
<pre class=”line after”><span class=”ws”> </span># Catch JSON-related errors and raise as requests.JSONDecodeError</pre>
<pre class=”line after”><span class=”ws”> </span># This aliases json.JSONDecodeError and simplejson.JSONDecodeError</pre>
<pre class=”line after”><span class=”ws”> </span>raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)</pre>
<pre class=”line after”><span class=”ws”></span> </pre></div>
</div><li><div class=”frame” id=”frame-2553431310960″>
<h4>File <cite class=”filename”>”C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\json\__init__.py”</cite>,
line <em class=”line”>346</em>,
in <code class=”function”>loads</code></h4>
<div class=”source “><pre class=”line before”><span class=”ws”> </span>s = s.decode(detect_encoding(s), 'surrogatepass')</pre>
<pre class=”line before”><span class=”ws”></span> </pre>
<pre class=”line before”><span class=”ws”> </span>if (cls is None and object_hook is None and</pre>
<pre class=”line before”><span class=”ws”> </span>parse_int is None and parse_float is None and</pre>
<pre class=”line before”><span class=”ws”> </span>parse_constant is None and object_pairs_hook is None and not kw):</pre>
<pre class=”line current”><span class=”ws”> </span>return _default_decoder.decode(s)</pre>
<pre class=”line after”><span class=”ws”> </span>if cls is None:</pre>
<pre class=”line after”><span class=”ws”> </span>cls = JSONDecoder</pre>
<pre class=”line after”><span class=”ws”> </span>if object_hook is not None:</pre>
<pre class=”line after”><span class=”ws”> </span>kw['object_hook'] = object_hook</pre>
<pre class=”line after”><span class=”ws”> </span>if object_pairs_hook is not None:</pre></div>
</div><li><div class=”frame” id=”frame-2553431311072″>
<h4>File <cite class=”filename”>”C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\json\decoder.py”</cite>,
line <em class=”line”>337</em>,
in <code class=”function”>decode</code></h4>
<div class=”source “><pre class=”line before”><span class=”ws”> </span>def decode(self, s, _w=WHITESPACE.match):</pre>
<pre class=”line before”><span class=”ws”> </span>"""Return the Python representation of “s“ (a “str“ instance</pre>
<pre class=”line before”><span class=”ws”> </span>containing a JSON document).</pre>
<pre class=”line before”><span class=”ws”></span> </pre>
<pre class=”line before”><span class=”ws”> </span>"""</pre>
<pre class=”line current”><span class=”ws”> </span>obj, end = self.raw_decode(s, idx=_w(s, 0).end())</pre>
<pre class=”line after”><span class=”ws”> </span>end = _w(s, end).end()</pre>
<pre class=”line after”><span class=”ws”> </span>if end != len(s):</pre>
<pre class=”line after”><span class=”ws”> </span>raise JSONDecodeError("Extra data", s, end)</pre>
<pre class=”line after”><span class=”ws”> </span>return obj</pre>
<pre class=”line after”><span class=”ws”></span> </pre></div>
</div><li><div class=”frame” id=”frame-2553431311296″>
<h4>File <cite class=”filename”>”C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\json\decoder.py”</cite>,
line <em class=”line”>355</em>,
in <code class=”function”>raw_decode</code></h4>
<div class=”source “><pre class=”line before”><span class=”ws”></span> </pre>
<pre class=”line before”><span class=”ws”> </span>"""</pre>
<pre class=”line before”><span class=”ws”> </span>try:</pre>
<pre class=”line before”><span class=”ws”> </span>obj, end = self.scan_once(s, idx)</pre>
<pre class=”line before”><span class=”ws”> </span>except StopIteration as err:</pre>
<pre class=”line current”><span class=”ws”> </span>raise JSONDecodeError("Expecting value", s, err.value) from None</pre>
<pre class=”line after”><span class=”ws”> </span>return obj, end</pre></div>
</div><li><div class=”exc-divider”>During handling of the above exception, another exception occurred:</div>
<li><div class=”frame” id=”frame-2553431235264″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\flask\app.py”</cite>,
line <em class=”line”>1478</em>,
in <code class=”function”>__call__</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”> </span>def __call__(self, environ: dict, start_response: t.Callable) -> t.Any:</pre>
<pre class=”line before”><span class=”ws”> </span>"""The WSGI server calls the Flask application object as the</pre>
<pre class=”line before”><span class=”ws”> </span>WSGI application. This calls :meth:`wsgi_app`, which can be</pre>
<pre class=”line before”><span class=”ws”> </span>wrapped to apply middleware.</pre>
<pre class=”line before”><span class=”ws”> </span>"""</pre>
<pre class=”line current”><span class=”ws”> </span>return self.wsgi_app(environ, start_response)</pre></div>
</div><li><div class=”frame” id=”frame-2553431235152″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\flask\app.py”</cite>,
line <em class=”line”>1458</em>,
in <code class=”function”>wsgi_app</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”> </span>try:</pre>
<pre class=”line before”><span class=”ws”> </span>ctx.push()</pre>
<pre class=”line before”><span class=”ws”> </span>response = self.full_dispatch_request()</pre>
<pre class=”line before”><span class=”ws”> </span>except Exception as e:</pre>
<pre class=”line before”><span class=”ws”> </span>error = e</pre>
<pre class=”line current”><span class=”ws”> </span>response = self.handle_exception(e)</pre>
<pre class=”line after”><span class=”ws”> </span>except: # noqa: B001</pre>
<pre class=”line after”><span class=”ws”> </span>error = sys.exc_info()[1]</pre>
<pre class=”line after”><span class=”ws”> </span>raise</pre>
<pre class=”line after”><span class=”ws”> </span>return response(environ, start_response)</pre>
<pre class=”line after”><span class=”ws”> </span>finally:</pre></div>
</div><li><div class=”frame” id=”frame-2553431234928″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\flask\app.py”</cite>,
line <em class=”line”>1455</em>,
in <code class=”function”>wsgi_app</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”> </span>ctx = self.request_context(environ)</pre>
<pre class=”line before”><span class=”ws”> </span>error: BaseException | None = None</pre>
<pre class=”line before”><span class=”ws”> </span>try:</pre>
<pre class=”line before”><span class=”ws”> </span>try:</pre>
<pre class=”line before”><span class=”ws”> </span>ctx.push()</pre>
<pre class=”line current”><span class=”ws”> </span>response = self.full_dispatch_request()</pre>
<pre class=”line after”><span class=”ws”> </span>except Exception as e:</pre>
<pre class=”line after”><span class=”ws”> </span>error = e</pre>
<pre class=”line after”><span class=”ws”> </span>response = self.handle_exception(e)</pre>
<pre class=”line after”><span class=”ws”> </span>except: # noqa: B001</pre>
<pre class=”line after”><span class=”ws”> </span>error = sys.exc_info()[1]</pre></div>
</div><li><div class=”frame” id=”frame-2553431235376″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\flask\app.py”</cite>,
line <em class=”line”>869</em>,
in <code class=”function”>full_dispatch_request</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”> </span>request_started.send(self, _async_wrapper=self.ensure_sync)</pre>
<pre class=”line before”><span class=”ws”> </span>rv = self.preprocess_request()</pre>
<pre class=”line before”><span class=”ws”> </span>if rv is None:</pre>
<pre class=”line before”><span class=”ws”> </span>rv = self.dispatch_request()</pre>
<pre class=”line before”><span class=”ws”> </span>except Exception as e:</pre>
<pre class=”line current”><span class=”ws”> </span>rv = self.handle_user_exception(e)</pre>
<pre class=”line after”><span class=”ws”> </span>return self.finalize_request(rv)</pre>
<pre class=”line after”><span class=”ws”></span> </pre>
<pre class=”line after”><span class=”ws”> </span>def finalize_request(</pre>
<pre class=”line after”><span class=”ws”> </span>self,</pre>
<pre class=”line after”><span class=”ws”> </span>rv: ft.ResponseReturnValue | HTTPException,</pre></div>
</div><li><div class=”frame” id=”frame-2553431235488″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\flask\app.py”</cite>,
line <em class=”line”>867</em>,
in <code class=”function”>full_dispatch_request</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre>
<pre class=”line before”><span class=”ws”> </span>try:</pre>
<pre class=”line before”><span class=”ws”> </span>request_started.send(self, _async_wrapper=self.ensure_sync)</pre>
<pre class=”line before”><span class=”ws”> </span>rv = self.preprocess_request()</pre>
<pre class=”line before”><span class=”ws”> </span>if rv is None:</pre>
<pre class=”line current”><span class=”ws”> </span>rv = self.dispatch_request()</pre>
<pre class=”line after”><span class=”ws”> </span>except Exception as e:</pre>
<pre class=”line after”><span class=”ws”> </span>rv = self.handle_user_exception(e)</pre>
<pre class=”line after”><span class=”ws”> </span>return self.finalize_request(rv)</pre>
<pre class=”line after”><span class=”ws”></span> </pre>
<pre class=”line after”><span class=”ws”> </span>def finalize_request(</pre></div>
</div><li><div class=”frame” id=”frame-2553431235600″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\flask\app.py”</cite>,
line <em class=”line”>852</em>,
in <code class=”function”>dispatch_request</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”> </span>and req.method == "OPTIONS"</pre>
<pre class=”line before”><span class=”ws”> </span>):</pre>
<pre class=”line before”><span class=”ws”> </span>return self.make_default_options_response()</pre>
<pre class=”line before”><span class=”ws”> </span># otherwise dispatch to the handler for that endpoint</pre>
<pre class=”line before”><span class=”ws”> </span>view_args: dict[str, t.Any] = req.view_args # type: ignore[assignment]</pre>
<pre class=”line current”><span class=”ws”> </span>return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)</pre>
<pre class=”line after”><span class=”ws”></span> </pre>
<pre class=”line after”><span class=”ws”> </span>def full_dispatch_request(self) -> Response:</pre>
<pre class=”line after”><span class=”ws”> </span>"""Dispatches the request and on top of that performs request</pre>
<pre class=”line after”><span class=”ws”> </span>pre and postprocessing as well as HTTP exception catching and</pre>
<pre class=”line after”><span class=”ws”> </span>error handling.</pre></div>
</div><li><div class=”frame” id=”frame-2553431235712″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\model_server.py”</cite>,
line <em class=”line”>322</em>,
in <code class=”function”>get_new_content_api</code></h4>
<div class=”source “><pre class=”line before”><span class=”ws”></span>def get_new_content_api():</pre>
<pre class=”line before”><span class=”ws”> </span>content = request.args.get('content')</pre>
<pre class=”line before”><span class=”ws”> </span>engine_type = request.args.get('engine_type')</pre>
<pre class=”line before”><span class=”ws”> </span>need_summary = request.args.get('need_summary')</pre>
<pre class=”line before”><span class=”ws”> </span>need_keywords = request.args.get('need_keywords')</pre>
<pre class=”line current”><span class=”ws”> </span>new_content = get_new_content(engine_type,need_summary,need_keywords,content) # 传递 len 参数,使用 30 作为长度</pre>
<pre class=”line after”><span class=”ws”> </span>return new_content</pre>
<pre class=”line after”><span class=”ws”></span>@retry(exceptions=ConnectionError,tries=tries,delay=1)</pre>
<pre class=”line after”><span class=”ws”></span>def get_new_content(engine_type,need_summary,need_keywords,init_content):</pre>
<pre class=”line after”><span class=”ws”> </span>if engine_type == RewriteEnum.EngineType.WENXINYIYAN:</pre>
<pre class=”line after”><span class=”ws”> </span>new_content = get_wp_post_wx_continue(need_summary,need_keywords ,init_content)</pre></div>
</div><li><div class=”frame” id=”frame-2553431235824″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\decorator.py”</cite>,
line <em class=”line”>232</em>,
in <code class=”function”>fun</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”> </span>yield res</pre>
<pre class=”line before”><span class=”ws”> </span>else:</pre>
<pre class=”line before”><span class=”ws”> </span>def fun(*args, **kw):</pre>
<pre class=”line before”><span class=”ws”> </span>if not kwsyntax:</pre>
<pre class=”line before”><span class=”ws”> </span>args, kw = fix(args, kw, sig)</pre>
<pre class=”line current”><span class=”ws”> </span>return caller(func, *(extras + args), **kw)</pre>
<pre class=”line after”><span class=”ws”> </span>fun.__name__ = func.__name__</pre>
<pre class=”line after”><span class=”ws”> </span>fun.__doc__ = func.__doc__</pre>
<pre class=”line after”><span class=”ws”> </span>fun.__wrapped__ = func</pre>
<pre class=”line after”><span class=”ws”> </span>fun.__signature__ = sig</pre>
<pre class=”line after”><span class=”ws”> </span>fun.__qualname__ = func.__qualname__</pre></div>
</div><li><div class=”frame” id=”frame-2553431235936″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\retry\api.py”</cite>,
line <em class=”line”>73</em>,
in <code class=”function”>retry_decorator</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre>
<pre class=”line before”><span class=”ws”> </span>@decorator</pre>
<pre class=”line before”><span class=”ws”> </span>def retry_decorator(f, *fargs, **fkwargs):</pre>
<pre class=”line before”><span class=”ws”> </span>args = fargs if fargs else list()</pre>
<pre class=”line before”><span class=”ws”> </span>kwargs = fkwargs if fkwargs else dict()</pre>
<pre class=”line current”><span class=”ws”> </span>return __retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter,</pre>
<pre class=”line after”><span class=”ws”> </span>logger)</pre>
<pre class=”line after”><span class=”ws”></span> </pre>
<pre class=”line after”><span class=”ws”> </span>return retry_decorator</pre>
<pre class=”line after”><span class=”ws”></span> </pre>
<pre class=”line after”><span class=”ws”></span> </pre></div>
</div><li><div class=”frame” id=”frame-2553431236048″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\retry\api.py”</cite>,
line <em class=”line”>33</em>,
in <code class=”function”>__retry_internal</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”> </span>:returns: the result of the f function.</pre>
<pre class=”line before”><span class=”ws”> </span>"""</pre>
<pre class=”line before”><span class=”ws”> </span>_tries, _delay = tries, delay</pre>
<pre class=”line before”><span class=”ws”> </span>while _tries:</pre>
<pre class=”line before”><span class=”ws”> </span>try:</pre>
<pre class=”line current”><span class=”ws”> </span>return f()</pre>
<pre class=”line after”><span class=”ws”> </span>except exceptions as e:</pre>
<pre class=”line after”><span class=”ws”> </span>_tries -= 1</pre>
<pre class=”line after”><span class=”ws”> </span>if not _tries:</pre>
<pre class=”line after”><span class=”ws”> </span>raise</pre>
<pre class=”line after”><span class=”ws”></span> </pre></div>
</div><li><div class=”frame” id=”frame-2553431236160″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\model_server.py”</cite>,
line <em class=”line”>329</em>,
in <code class=”function”>get_new_content</code></h4>
<div class=”source “><pre class=”line before”><span class=”ws”></span>@retry(exceptions=ConnectionError,tries=tries,delay=1)</pre>
<pre class=”line before”><span class=”ws”></span>def get_new_content(engine_type,need_summary,need_keywords,init_content):</pre>
<pre class=”line before”><span class=”ws”> </span>if engine_type == RewriteEnum.EngineType.WENXINYIYAN:</pre>
<pre class=”line before”><span class=”ws”> </span>new_content = get_wp_post_wx_continue(need_summary,need_keywords ,init_content)</pre>
<pre class=”line before”><span class=”ws”> </span>else:</pre>
<pre class=”line current”><span class=”ws”> </span>new_content = get_new_content_chatglm(init_content)</pre>
<pre class=”line after”><span class=”ws”> </span>return new_content</pre>
<pre class=”line after”><span class=”ws”></span>@retry(exceptions=ConnectionError,tries=tries,delay=1)</pre>
<pre class=”line after”><span class=”ws”></span>def get_new_content_chatglm(content):</pre>
<pre class=”line after”><span class=”ws”> </span>payload = {</pre>
<pre class=”line after”><span class=”ws”> </span>"model": "chatglm3-6b",</pre></div>
</div><li><div class=”frame” id=”frame-2553431236384″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\decorator.py”</cite>,
line <em class=”line”>232</em>,
in <code class=”function”>fun</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”> </span>yield res</pre>
<pre class=”line before”><span class=”ws”> </span>else:</pre>
<pre class=”line before”><span class=”ws”> </span>def fun(*args, **kw):</pre>
<pre class=”line before”><span class=”ws”> </span>if not kwsyntax:</pre>
<pre class=”line before”><span class=”ws”> </span>args, kw = fix(args, kw, sig)</pre>
<pre class=”line current”><span class=”ws”> </span>return caller(func, *(extras + args), **kw)</pre>
<pre class=”line after”><span class=”ws”> </span>fun.__name__ = func.__name__</pre>
<pre class=”line after”><span class=”ws”> </span>fun.__doc__ = func.__doc__</pre>
<pre class=”line after”><span class=”ws”> </span>fun.__wrapped__ = func</pre>
<pre class=”line after”><span class=”ws”> </span>fun.__signature__ = sig</pre>
<pre class=”line after”><span class=”ws”> </span>fun.__qualname__ = func.__qualname__</pre></div>
</div><li><div class=”frame” id=”frame-2553431236496″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\retry\api.py”</cite>,
line <em class=”line”>73</em>,
in <code class=”function”>retry_decorator</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre>
<pre class=”line before”><span class=”ws”> </span>@decorator</pre>
<pre class=”line before”><span class=”ws”> </span>def retry_decorator(f, *fargs, **fkwargs):</pre>
<pre class=”line before”><span class=”ws”> </span>args = fargs if fargs else list()</pre>
<pre class=”line before”><span class=”ws”> </span>kwargs = fkwargs if fkwargs else dict()</pre>
<pre class=”line current”><span class=”ws”> </span>return __retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter,</pre>
<pre class=”line after”><span class=”ws”> </span>logger)</pre>
<pre class=”line after”><span class=”ws”></span> </pre>
<pre class=”line after”><span class=”ws”> </span>return retry_decorator</pre>
<pre class=”line after”><span class=”ws”></span> </pre>
<pre class=”line after”><span class=”ws”></span> </pre></div>
</div><li><div class=”frame” id=”frame-2553431310400″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\retry\api.py”</cite>,
line <em class=”line”>33</em>,
in <code class=”function”>__retry_internal</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”> </span>:returns: the result of the f function.</pre>
<pre class=”line before”><span class=”ws”> </span>"""</pre>
<pre class=”line before”><span class=”ws”> </span>_tries, _delay = tries, delay</pre>
<pre class=”line before”><span class=”ws”> </span>while _tries:</pre>
<pre class=”line before”><span class=”ws”> </span>try:</pre>
<pre class=”line current”><span class=”ws”> </span>return f()</pre>
<pre class=”line after”><span class=”ws”> </span>except exceptions as e:</pre>
<pre class=”line after”><span class=”ws”> </span>_tries -= 1</pre>
<pre class=”line after”><span class=”ws”> </span>if not _tries:</pre>
<pre class=”line after”><span class=”ws”> </span>raise</pre>
<pre class=”line after”><span class=”ws”></span> </pre></div>
</div><li><div class=”frame” id=”frame-2553431310512″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\model_server.py”</cite>,
line <em class=”line”>357</em>,
in <code class=”function”>get_new_content_chatglm</code></h4>
<div class=”source “><pre class=”line before”><span class=”ws”> </span>}</pre>
<pre class=”line before”><span class=”ws”> </span>headers = {"content-type": "application/json"}</pre>
<pre class=”line before”><span class=”ws”> </span>task_start_time = time.time()</pre>
<pre class=”line before”><span class=”ws”> </span>response = requests.request("POST", chatglm_url, json=payload, headers=headers)</pre>
<pre class=”line before”><span class=”ws”> </span>#print(response)</pre>
<pre class=”line current”><span class=”ws”> </span>data = response.json()</pre>
<pre class=”line after”><span class=”ws”> </span>print(json.dumps(data, indent=4))</pre>
<pre class=”line after”><span class=”ws”> </span>new_content = data['choices'][0]['message']['content']</pre>
<pre class=”line after”><span class=”ws”> </span>new_content = new_content.replace("重新改写后:", "").replace("", "")</pre>
<pre class=”line after”><span class=”ws”> </span>new_content = new_content.replace("重新组织后:", "")</pre>
<pre class=”line after”><span class=”ws”> </span>new_content = new_content.replace("\n", "")</pre></div>
</div><li><div class=”frame” id=”frame-2553431310624″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\models.py”</cite>,
line <em class=”line”>975</em>,
in <code class=”function”>json</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”> </span>try:</pre>
<pre class=”line before”><span class=”ws”> </span>return complexjson.loads(self.text, **kwargs)</pre>
<pre class=”line before”><span class=”ws”> </span>except JSONDecodeError as e:</pre>
<pre class=”line before”><span class=”ws”> </span># Catch JSON-related errors and raise as requests.JSONDecodeError</pre>
<pre class=”line before”><span class=”ws”> </span># This aliases json.JSONDecodeError and simplejson.JSONDecodeError</pre>
<pre class=”line current”><span class=”ws”> </span>raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)</pre>
<pre class=”line after”><span class=”ws”></span> </pre>
<pre class=”line after”><span class=”ws”> </span>@property</pre>
<pre class=”line after”><span class=”ws”> </span>def links(self):</pre>
<pre class=”line after”><span class=”ws”> </span>"""Returns the parsed header links of the response, if any."""</pre>
<pre class=”line after”><span class=”ws”></span> </pre></div>
</div>
</ul>
<blockquote>requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
</blockquote>
</div><div class=”plain”>
<p>
This is the Copy/Paste friendly version of the traceback.
</p>
<textarea cols=”50″ rows=”10″ name=”code” readonly>Traceback (most recent call last):
File "F:\project\wxgzh\venv\lib\site-packages\requests\models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\project\wxgzh\venv\lib\site-packages\flask\app.py", line 1478, in __call__
return self.wsgi_app(environ, start_response)
File "F:\project\wxgzh\venv\lib\site-packages\flask\app.py", line 1458, in wsgi_app
response = self.handle_exception(e)
File "F:\project\wxgzh\venv\lib\site-packages\flask\app.py", line 1455, in wsgi_app
response = self.full_dispatch_request()
File "F:\project\wxgzh\venv\lib\site-packages\flask\app.py", line 869, in full_dispatch_request
rv = self.handle_user_exception(e)
File "F:\project\wxgzh\venv\lib\site-packages\flask\app.py", line 867, in full_dispatch_request
rv = self.dispatch_request()
File "F:\project\wxgzh\venv\lib\site-packages\flask\app.py", line 852, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "F:\project\wxgzh\model_server.py", line 322, in get_new_content_api
new_content = get_new_content(engine_type,need_summary,need_keywords,content) # 传递 len 参数,使用 30 作为长度
File "F:\project\wxgzh\venv\lib\site-packages\decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "F:\project\wxgzh\venv\lib\site-packages\retry\api.py", line 73, in retry_decorator
return __retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter,
File "F:\project\wxgzh\venv\lib\site-packages\retry\api.py", line 33, in __retry_internal
return f()
File "F:\project\wxgzh\model_server.py", line 329, in get_new_content
new_content = get_new_content_chatglm(init_content)
File "F:\project\wxgzh\venv\lib\site-packages\decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "F:\project\wxgzh\venv\lib\site-packages\retry\api.py", line 73, in retry_decorator
return __retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter,
File "F:\project\wxgzh\venv\lib\site-packages\retry\api.py", line 33, in __retry_internal
return f()
File "F:\project\wxgzh\model_server.py", line 357, in get_new_content_chatglm
data = response.json()
File "F:\project\wxgzh\venv\lib\site-packages\requests\models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
</textarea>
</div>
<div class=”explanation”>
The debugger caught an exception in your WSGI application. You can now
look at the traceback which led to the error. <span class=”nojavascript”>
If you enable JavaScript you can also use additional features such as code
execution (if the evalex feature is enabled), automatic pasting of the
exceptions and much more.</span>
</div>
<div class=”footer”>
Brought to you by <strong class=”arthur”>DON’T PANIC</strong>, your
friendly Werkzeug powered traceback interpreter.
</div>
</div><div class=”pin-prompt”>
<div class=”inner”>
<h3>Console Locked</h3>
<p>
The console is locked and needs to be unlocked by entering the PIN.
You can find the PIN printed out on the standard output of your
shell that runs the server.
<form>
<p>PIN:
<input type=text name=pin size=14>
<input type=submit name=btn value=”Confirm Pin”>
</form>
</div>
</div>
</body>
</html><!–
Traceback (most recent call last):
File “F:\project\wxgzh\venv\lib\site-packages\requests\models.py”, line 971, in json
return complexjson.loads(self.text, **kwargs)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\json\__init__.py”, line 346, in loads
return _default_decoder.decode(s)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\json\decoder.py”, line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\json\decoder.py”, line 355, in raw_decode
raise JSONDecodeError(“Expecting value”, s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “F:\project\wxgzh\venv\lib\site-packages\flask\app.py”, line 1478, in __call__
return self.wsgi_app(environ, start_response)
File “F:\project\wxgzh\venv\lib\site-packages\flask\app.py”, line 1458, in wsgi_app
response = self.handle_exception(e)
File “F:\project\wxgzh\venv\lib\site-packages\flask\app.py”, line 1455, in wsgi_app
response = self.full_dispatch_request()
File “F:\project\wxgzh\venv\lib\site-packages\flask\app.py”, line 869, in full_dispatch_request
rv = self.handle_user_exception(e)
File “F:\project\wxgzh\venv\lib\site-packages\flask\app.py”, line 867, in full_dispatch_request
rv = self.dispatch_request()
File “F:\project\wxgzh\venv\lib\site-packages\flask\app.py”, line 852, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File “F:\project\wxgzh\model_server.py”, line 322, in get_new_content_api
new_content = get_new_content(engine_type,need_summary,need_keywords,content) # 传递 len 参数,使用 30 作为长度
File “F:\project\wxgzh\venv\lib\site-packages\decorator.py”, line 232, in fun
return caller(func, *(extras + args), **kw)
File “F:\project\wxgzh\venv\lib\site-packages\retry\api.py”, line 73, in retry_decorator
return __retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter,
File “F:\project\wxgzh\venv\lib\site-packages\retry\api.py”, line 33, in __retry_internal
return f()
File “F:\project\wxgzh\model_server.py”, line 329, in get_new_content
new_content = get_new_content_chatglm(init_content)
File “F:\project\wxgzh\venv\lib\site-packages\decorator.py”, line 232, in fun
return caller(func, *(extras + args), **kw)
File “F:\project\wxgzh\venv\lib\site-packages\retry\api.py”, line 73, in retry_decorator
return __retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter,
File “F:\project\wxgzh\venv\lib\site-packages\retry\api.py”, line 33, in __retry_internal
return f()
File “F:\project\wxgzh\model_server.py”, line 357, in get_new_content_chatglm
data = response.json()
File “F:\project\wxgzh\venv\lib\site-packages\requests\models.py”, line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)–>
在生成质量方面,基于对语义理解、输出表达、适应泛化的综合评测,文心一言得分率 76.98%,仅次于 GPT-4,领先于包括 ChatGPT 在内的其他大语言模型。其中,在部分中文语义理解方面,文心一言以 92% 的得分率排名榜首。
<!doctype html>
<html lang=en>
<head>
<title>requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
// Werkzeug Debugger</title>
<link rel=”stylesheet” href=”?__debugger__=yes&cmd=resource&f=style.css”>
<link rel=”shortcut icon”
href=”?__debugger__=yes&cmd=resource&f=console.png”>
<script src=”?__debugger__=yes&cmd=resource&f=debugger.js”></script>
<script>
var CONSOLE_MODE = false,
EVALEX = true,
EVALEX_TRUSTED = false,
SECRET = “uImqR9BO9WQOrgY4YnuS”;
</script>
</head>
<body style=”background-color: #fff”>
<div class=”debugger”>
<h1>JSONDecodeError</h1>
<div class=”detail”>
<p class=”errormsg”>requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
</p>
</div>
<h2 class=”traceback”>Traceback <em>(most recent call last)</em></h2>
<div class=”traceback”>
<h3></h3>
<ul><li><div class=”frame” id=”frame-2553431398208″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\models.py”</cite>,
line <em class=”line”>971</em>,
in <code class=”function”>json</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”> </span>pass</pre>
<pre class=”line before”><span class=”ws”> </span>except JSONDecodeError as e:</pre>
<pre class=”line before”><span class=”ws”> </span>raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)</pre>
<pre class=”line before”><span class=”ws”></span> </pre>
<pre class=”line before”><span class=”ws”> </span>try:</pre>
<pre class=”line current”><span class=”ws”> </span>return complexjson.loads(self.text, **kwargs)</pre>
<pre class=”line after”><span class=”ws”> </span>except JSONDecodeError as e:</pre>
<pre class=”line after”><span class=”ws”> </span># Catch JSON-related errors and raise as requests.JSONDecodeError</pre>
<pre class=”line after”><span class=”ws”> </span># This aliases json.JSONDecodeError and simplejson.JSONDecodeError</pre>
<pre class=”line after”><span class=”ws”> </span>raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)</pre>
<pre class=”line after”><span class=”ws”></span> </pre></div>
</div><li><div class=”frame” id=”frame-2553431398320″>
<h4>File <cite class=”filename”>”C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\json\__init__.py”</cite>,
line <em class=”line”>346</em>,
in <code class=”function”>loads</code></h4>
<div class=”source “><pre class=”line before”><span class=”ws”> </span>s = s.decode(detect_encoding(s), 'surrogatepass')</pre>
<pre class=”line before”><span class=”ws”></span> </pre>
<pre class=”line before”><span class=”ws”> </span>if (cls is None and object_hook is None and</pre>
<pre class=”line before”><span class=”ws”> </span>parse_int is None and parse_float is None and</pre>
<pre class=”line before”><span class=”ws”> </span>parse_constant is None and object_pairs_hook is None and not kw):</pre>
<pre class=”line current”><span class=”ws”> </span>return _default_decoder.decode(s)</pre>
<pre class=”line after”><span class=”ws”> </span>if cls is None:</pre>
<pre class=”line after”><span class=”ws”> </span>cls = JSONDecoder</pre>
<pre class=”line after”><span class=”ws”> </span>if object_hook is not None:</pre>
<pre class=”line after”><span class=”ws”> </span>kw['object_hook'] = object_hook</pre>
<pre class=”line after”><span class=”ws”> </span>if object_pairs_hook is not None:</pre></div>
</div><li><div class=”frame” id=”frame-2553431398432″>
<h4>File <cite class=”filename”>”C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\json\decoder.py”</cite>,
line <em class=”line”>337</em>,
in <code class=”function”>decode</code></h4>
<div class=”source “><pre class=”line before”><span class=”ws”> </span>def decode(self, s, _w=WHITESPACE.match):</pre>
<pre class=”line before”><span class=”ws”> </span>"""Return the Python representation of “s“ (a “str“ instance</pre>
<pre class=”line before”><span class=”ws”> </span>containing a JSON document).</pre>
<pre class=”line before”><span class=”ws”></span> </pre>
<pre class=”line before”><span class=”ws”> </span>"""</pre>
<pre class=”line current”><span class=”ws”> </span>obj, end = self.raw_decode(s, idx=_w(s, 0).end())</pre>
<pre class=”line after”><span class=”ws”> </span>end = _w(s, end).end()</pre>
<pre class=”line after”><span class=”ws”> </span>if end != len(s):</pre>
<pre class=”line after”><span class=”ws”> </span>raise JSONDecodeError("Extra data", s, end)</pre>
<pre class=”line after”><span class=”ws”> </span>return obj</pre>
<pre class=”line after”><span class=”ws”></span> </pre></div>
</div><li><div class=”frame” id=”frame-2553431398656″>
<h4>File <cite class=”filename”>”C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\json\decoder.py”</cite>,
line <em class=”line”>355</em>,
in <code class=”function”>raw_decode</code></h4>
<div class=”source “><pre class=”line before”><span class=”ws”></span> </pre>
<pre class=”line before”><span class=”ws”> </span>"""</pre>
<pre class=”line before”><span class=”ws”> </span>try:</pre>
<pre class=”line before”><span class=”ws”> </span>obj, end = self.scan_once(s, idx)</pre>
<pre class=”line before”><span class=”ws”> </span>except StopIteration as err:</pre>
<pre class=”line current”><span class=”ws”> </span>raise JSONDecodeError("Expecting value", s, err.value) from None</pre>
<pre class=”line after”><span class=”ws”> </span>return obj, end</pre></div>
</div><li><div class=”exc-divider”>During handling of the above exception, another exception occurred:</div>
<li><div class=”frame” id=”frame-2553431314096″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\flask\app.py”</cite>,
line <em class=”line”>1478</em>,
in <code class=”function”>__call__</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”> </span>def __call__(self, environ: dict, start_response: t.Callable) -> t.Any:</pre>
<pre class=”line before”><span class=”ws”> </span>"""The WSGI server calls the Flask application object as the</pre>
<pre class=”line before”><span class=”ws”> </span>WSGI application. This calls :meth:`wsgi_app`, which can be</pre>
<pre class=”line before”><span class=”ws”> </span>wrapped to apply middleware.</pre>
<pre class=”line before”><span class=”ws”> </span>"""</pre>
<pre class=”line current”><span class=”ws”> </span>return self.wsgi_app(environ, start_response)</pre></div>
</div><li><div class=”frame” id=”frame-2553431314320″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\flask\app.py”</cite>,
line <em class=”line”>1458</em>,
in <code class=”function”>wsgi_app</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”> </span>try:</pre>
<pre class=”line before”><span class=”ws”> </span>ctx.push()</pre>
<pre class=”line before”><span class=”ws”> </span>response = self.full_dispatch_request()</pre>
<pre class=”line before”><span class=”ws”> </span>except Exception as e:</pre>
<pre class=”line before”><span class=”ws”> </span>error = e</pre>
<pre class=”line current”><span class=”ws”> </span>response = self.handle_exception(e)</pre>
<pre class=”line after”><span class=”ws”> </span>except: # noqa: B001</pre>
<pre class=”line after”><span class=”ws”> </span>error = sys.exc_info()[1]</pre>
<pre class=”line after”><span class=”ws”> </span>raise</pre>
<pre class=”line after”><span class=”ws”> </span>return response(environ, start_response)</pre>
<pre class=”line after”><span class=”ws”> </span>finally:</pre></div>
</div><li><div class=”frame” id=”frame-2553431396416″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\flask\app.py”</cite>,
line <em class=”line”>1455</em>,
in <code class=”function”>wsgi_app</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”> </span>ctx = self.request_context(environ)</pre>
<pre class=”line before”><span class=”ws”> </span>error: BaseException | None = None</pre>
<pre class=”line before”><span class=”ws”> </span>try:</pre>
<pre class=”line before”><span class=”ws”> </span>try:</pre>
<pre class=”line before”><span class=”ws”> </span>ctx.push()</pre>
<pre class=”line current”><span class=”ws”> </span>response = self.full_dispatch_request()</pre>
<pre class=”line after”><span class=”ws”> </span>except Exception as e:</pre>
<pre class=”line after”><span class=”ws”> </span>error = e</pre>
<pre class=”line after”><span class=”ws”> </span>response = self.handle_exception(e)</pre>
<pre class=”line after”><span class=”ws”> </span>except: # noqa: B001</pre>
<pre class=”line after”><span class=”ws”> </span>error = sys.exc_info()[1]</pre></div>
</div><li><div class=”frame” id=”frame-2553431396528″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\flask\app.py”</cite>,
line <em class=”line”>869</em>,
in <code class=”function”>full_dispatch_request</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”> </span>request_started.send(self, _async_wrapper=self.ensure_sync)</pre>
<pre class=”line before”><span class=”ws”> </span>rv = self.preprocess_request()</pre>
<pre class=”line before”><span class=”ws”> </span>if rv is None:</pre>
<pre class=”line before”><span class=”ws”> </span>rv = self.dispatch_request()</pre>
<pre class=”line before”><span class=”ws”> </span>except Exception as e:</pre>
<pre class=”line current”><span class=”ws”> </span>rv = self.handle_user_exception(e)</pre>
<pre class=”line after”><span class=”ws”> </span>return self.finalize_request(rv)</pre>
<pre class=”line after”><span class=”ws”></span> </pre>
<pre class=”line after”><span class=”ws”> </span>def finalize_request(</pre>
<pre class=”line after”><span class=”ws”> </span>self,</pre>
<pre class=”line after”><span class=”ws”> </span>rv: ft.ResponseReturnValue | HTTPException,</pre></div>
</div><li><div class=”frame” id=”frame-2553431396640″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\flask\app.py”</cite>,
line <em class=”line”>867</em>,
in <code class=”function”>full_dispatch_request</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre>
<pre class=”line before”><span class=”ws”> </span>try:</pre>
<pre class=”line before”><span class=”ws”> </span>request_started.send(self, _async_wrapper=self.ensure_sync)</pre>
<pre class=”line before”><span class=”ws”> </span>rv = self.preprocess_request()</pre>
<pre class=”line before”><span class=”ws”> </span>if rv is None:</pre>
<pre class=”line current”><span class=”ws”> </span>rv = self.dispatch_request()</pre>
<pre class=”line after”><span class=”ws”> </span>except Exception as e:</pre>
<pre class=”line after”><span class=”ws”> </span>rv = self.handle_user_exception(e)</pre>
<pre class=”line after”><span class=”ws”> </span>return self.finalize_request(rv)</pre>
<pre class=”line after”><span class=”ws”></span> </pre>
<pre class=”line after”><span class=”ws”> </span>def finalize_request(</pre></div>
</div><li><div class=”frame” id=”frame-2553431396752″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\flask\app.py”</cite>,
line <em class=”line”>852</em>,
in <code class=”function”>dispatch_request</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”> </span>and req.method == "OPTIONS"</pre>
<pre class=”line before”><span class=”ws”> </span>):</pre>
<pre class=”line before”><span class=”ws”> </span>return self.make_default_options_response()</pre>
<pre class=”line before”><span class=”ws”> </span># otherwise dispatch to the handler for that endpoint</pre>
<pre class=”line before”><span class=”ws”> </span>view_args: dict[str, t.Any] = req.view_args # type: ignore[assignment]</pre>
<pre class=”line current”><span class=”ws”> </span>return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)</pre>
<pre class=”line after”><span class=”ws”></span> </pre>
<pre class=”line after”><span class=”ws”> </span>def full_dispatch_request(self) -> Response:</pre>
<pre class=”line after”><span class=”ws”> </span>"""Dispatches the request and on top of that performs request</pre>
<pre class=”line after”><span class=”ws”> </span>pre and postprocessing as well as HTTP exception catching and</pre>
<pre class=”line after”><span class=”ws”> </span>error handling.</pre></div>
</div><li><div class=”frame” id=”frame-2553431396864″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\model_server.py”</cite>,
line <em class=”line”>322</em>,
in <code class=”function”>get_new_content_api</code></h4>
<div class=”source “><pre class=”line before”><span class=”ws”></span>def get_new_content_api():</pre>
<pre class=”line before”><span class=”ws”> </span>content = request.args.get('content')</pre>
<pre class=”line before”><span class=”ws”> </span>engine_type = request.args.get('engine_type')</pre>
<pre class=”line before”><span class=”ws”> </span>need_summary = request.args.get('need_summary')</pre>
<pre class=”line before”><span class=”ws”> </span>need_keywords = request.args.get('need_keywords')</pre>
<pre class=”line current”><span class=”ws”> </span>new_content = get_new_content(engine_type,need_summary,need_keywords,content) # 传递 len 参数,使用 30 作为长度</pre>
<pre class=”line after”><span class=”ws”> </span>return new_content</pre>
<pre class=”line after”><span class=”ws”></span>@retry(exceptions=ConnectionError,tries=tries,delay=1)</pre>
<pre class=”line after”><span class=”ws”></span>def get_new_content(engine_type,need_summary,need_keywords,init_content):</pre>
<pre class=”line after”><span class=”ws”> </span>if engine_type == RewriteEnum.EngineType.WENXINYIYAN:</pre>
<pre class=”line after”><span class=”ws”> </span>new_content = get_wp_post_wx_continue(need_summary,need_keywords ,init_content)</pre></div>
</div><li><div class=”frame” id=”frame-2553431396976″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\decorator.py”</cite>,
line <em class=”line”>232</em>,
in <code class=”function”>fun</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”> </span>yield res</pre>
<pre class=”line before”><span class=”ws”> </span>else:</pre>
<pre class=”line before”><span class=”ws”> </span>def fun(*args, **kw):</pre>
<pre class=”line before”><span class=”ws”> </span>if not kwsyntax:</pre>
<pre class=”line before”><span class=”ws”> </span>args, kw = fix(args, kw, sig)</pre>
<pre class=”line current”><span class=”ws”> </span>return caller(func, *(extras + args), **kw)</pre>
<pre class=”line after”><span class=”ws”> </span>fun.__name__ = func.__name__</pre>
<pre class=”line after”><span class=”ws”> </span>fun.__doc__ = func.__doc__</pre>
<pre class=”line after”><span class=”ws”> </span>fun.__wrapped__ = func</pre>
<pre class=”line after”><span class=”ws”> </span>fun.__signature__ = sig</pre>
<pre class=”line after”><span class=”ws”> </span>fun.__qualname__ = func.__qualname__</pre></div>
</div><li><div class=”frame” id=”frame-2553431397088″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\retry\api.py”</cite>,
line <em class=”line”>73</em>,
in <code class=”function”>retry_decorator</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre>
<pre class=”line before”><span class=”ws”> </span>@decorator</pre>
<pre class=”line before”><span class=”ws”> </span>def retry_decorator(f, *fargs, **fkwargs):</pre>
<pre class=”line before”><span class=”ws”> </span>args = fargs if fargs else list()</pre>
<pre class=”line before”><span class=”ws”> </span>kwargs = fkwargs if fkwargs else dict()</pre>
<pre class=”line current”><span class=”ws”> </span>return __retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter,</pre>
<pre class=”line after”><span class=”ws”> </span>logger)</pre>
<pre class=”line after”><span class=”ws”></span> </pre>
<pre class=”line after”><span class=”ws”> </span>return retry_decorator</pre>
<pre class=”line after”><span class=”ws”></span> </pre>
<pre class=”line after”><span class=”ws”></span> </pre></div>
</div><li><div class=”frame” id=”frame-2553431397200″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\retry\api.py”</cite>,
line <em class=”line”>33</em>,
in <code class=”function”>__retry_internal</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”> </span>:returns: the result of the f function.</pre>
<pre class=”line before”><span class=”ws”> </span>"""</pre>
<pre class=”line before”><span class=”ws”> </span>_tries, _delay = tries, delay</pre>
<pre class=”line before”><span class=”ws”> </span>while _tries:</pre>
<pre class=”line before”><span class=”ws”> </span>try:</pre>
<pre class=”line current”><span class=”ws”> </span>return f()</pre>
<pre class=”line after”><span class=”ws”> </span>except exceptions as e:</pre>
<pre class=”line after”><span class=”ws”> </span>_tries -= 1</pre>
<pre class=”line after”><span class=”ws”> </span>if not _tries:</pre>
<pre class=”line after”><span class=”ws”> </span>raise</pre>
<pre class=”line after”><span class=”ws”></span> </pre></div>
</div><li><div class=”frame” id=”frame-2553431397312″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\model_server.py”</cite>,
line <em class=”line”>329</em>,
in <code class=”function”>get_new_content</code></h4>
<div class=”source “><pre class=”line before”><span class=”ws”></span>@retry(exceptions=ConnectionError,tries=tries,delay=1)</pre>
<pre class=”line before”><span class=”ws”></span>def get_new_content(engine_type,need_summary,need_keywords,init_content):</pre>
<pre class=”line before”><span class=”ws”> </span>if engine_type == RewriteEnum.EngineType.WENXINYIYAN:</pre>
<pre class=”line before”><span class=”ws”> </span>new_content = get_wp_post_wx_continue(need_summary,need_keywords ,init_content)</pre>
<pre class=”line before”><span class=”ws”> </span>else:</pre>
<pre class=”line current”><span class=”ws”> </span>new_content = get_new_content_chatglm(init_content)</pre>
<pre class=”line after”><span class=”ws”> </span>return new_content</pre>
<pre class=”line after”><span class=”ws”></span>@retry(exceptions=ConnectionError,tries=tries,delay=1)</pre>
<pre class=”line after”><span class=”ws”></span>def get_new_content_chatglm(content):</pre>
<pre class=”line after”><span class=”ws”> </span>payload = {</pre>
<pre class=”line after”><span class=”ws”> </span>"model": "chatglm3-6b",</pre></div>
</div><li><div class=”frame” id=”frame-2553431397536″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\decorator.py”</cite>,
line <em class=”line”>232</em>,
in <code class=”function”>fun</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”> </span>yield res</pre>
<pre class=”line before”><span class=”ws”> </span>else:</pre>
<pre class=”line before”><span class=”ws”> </span>def fun(*args, **kw):</pre>
<pre class=”line before”><span class=”ws”> </span>if not kwsyntax:</pre>
<pre class=”line before”><span class=”ws”> </span>args, kw = fix(args, kw, sig)</pre>
<pre class=”line current”><span class=”ws”> </span>return caller(func, *(extras + args), **kw)</pre>
<pre class=”line after”><span class=”ws”> </span>fun.__name__ = func.__name__</pre>
<pre class=”line after”><span class=”ws”> </span>fun.__doc__ = func.__doc__</pre>
<pre class=”line after”><span class=”ws”> </span>fun.__wrapped__ = func</pre>
<pre class=”line after”><span class=”ws”> </span>fun.__signature__ = sig</pre>
<pre class=”line after”><span class=”ws”> </span>fun.__qualname__ = func.__qualname__</pre></div>
</div><li><div class=”frame” id=”frame-2553431397648″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\retry\api.py”</cite>,
line <em class=”line”>73</em>,
in <code class=”function”>retry_decorator</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre>
<pre class=”line before”><span class=”ws”> </span>@decorator</pre>
<pre class=”line before”><span class=”ws”> </span>def retry_decorator(f, *fargs, **fkwargs):</pre>
<pre class=”line before”><span class=”ws”> </span>args = fargs if fargs else list()</pre>
<pre class=”line before”><span class=”ws”> </span>kwargs = fkwargs if fkwargs else dict()</pre>
<pre class=”line current”><span class=”ws”> </span>return __retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter,</pre>
<pre class=”line after”><span class=”ws”> </span>logger)</pre>
<pre class=”line after”><span class=”ws”></span> </pre>
<pre class=”line after”><span class=”ws”> </span>return retry_decorator</pre>
<pre class=”line after”><span class=”ws”></span> </pre>
<pre class=”line after”><span class=”ws”></span> </pre></div>
</div><li><div class=”frame” id=”frame-2553431397760″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\retry\api.py”</cite>,
line <em class=”line”>33</em>,
in <code class=”function”>__retry_internal</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”> </span>:returns: the result of the f function.</pre>
<pre class=”line before”><span class=”ws”> </span>"""</pre>
<pre class=”line before”><span class=”ws”> </span>_tries, _delay = tries, delay</pre>
<pre class=”line before”><span class=”ws”> </span>while _tries:</pre>
<pre class=”line before”><span class=”ws”> </span>try:</pre>
<pre class=”line current”><span class=”ws”> </span>return f()</pre>
<pre class=”line after”><span class=”ws”> </span>except exceptions as e:</pre>
<pre class=”line after”><span class=”ws”> </span>_tries -= 1</pre>
<pre class=”line after”><span class=”ws”> </span>if not _tries:</pre>
<pre class=”line after”><span class=”ws”> </span>raise</pre>
<pre class=”line after”><span class=”ws”></span> </pre></div>
</div><li><div class=”frame” id=”frame-2553431397872″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\model_server.py”</cite>,
line <em class=”line”>357</em>,
in <code class=”function”>get_new_content_chatglm</code></h4>
<div class=”source “><pre class=”line before”><span class=”ws”> </span>}</pre>
<pre class=”line before”><span class=”ws”> </span>headers = {"content-type": "application/json"}</pre>
<pre class=”line before”><span class=”ws”> </span>task_start_time = time.time()</pre>
<pre class=”line before”><span class=”ws”> </span>response = requests.request("POST", chatglm_url, json=payload, headers=headers)</pre>
<pre class=”line before”><span class=”ws”> </span>#print(response)</pre>
<pre class=”line current”><span class=”ws”> </span>data = response.json()</pre>
<pre class=”line after”><span class=”ws”> </span>print(json.dumps(data, indent=4))</pre>
<pre class=”line after”><span class=”ws”> </span>new_content = data['choices'][0]['message']['content']</pre>
<pre class=”line after”><span class=”ws”> </span>new_content = new_content.replace("重新改写后:", "").replace("", "")</pre>
<pre class=”line after”><span class=”ws”> </span>new_content = new_content.replace("重新组织后:", "")</pre>
<pre class=”line after”><span class=”ws”> </span>new_content = new_content.replace("\n", "")</pre></div>
</div><li><div class=”frame” id=”frame-2553431397984″>
<h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\models.py”</cite>,
line <em class=”line”>975</em>,
in <code class=”function”>json</code></h4>
<div class=”source library”><pre class=”line before”><span class=”ws”> </span>try:</pre>
<pre class=”line before”><span class=”ws”> </span>return complexjson.loads(self.text, **kwargs)</pre>
<pre class=”line before”><span class=”ws”> </span>except JSONDecodeError as e:</pre>
<pre class=”line before”><span class=”ws”> </span># Catch JSON-related errors and raise as requests.JSONDecodeError</pre>
<pre class=”line before”><span class=”ws”> </span># This aliases json.JSONDecodeError and simplejson.JSONDecodeError</pre>
<pre class=”line current”><span class=”ws”> </span>raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)</pre>
<pre class=”line after”><span class=”ws”></span> </pre>
<pre class=”line after”><span class=”ws”> </span>@property</pre>
<pre class=”line after”><span class=”ws”> </span>def links(self):</pre>
<pre class=”line after”><span class=”ws”> </span>"""Returns the parsed header links of the response, if any."""</pre>
<pre class=”line after”><span class=”ws”></span> </pre></div>
</div>
</ul>
<blockquote>requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
</blockquote>
</div><div class=”plain”>
<p>
This is the Copy/Paste friendly version of the traceback.
</p>
<textarea cols=”50″ rows=”10″ name=”code” readonly>Traceback (most recent call last):
File "F:\project\wxgzh\venv\lib\site-packages\requests\models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\project\wxgzh\venv\lib\site-packages\flask\app.py", line 1478, in __call__
return self.wsgi_app(environ, start_response)
File "F:\project\wxgzh\venv\lib\site-packages\flask\app.py", line 1458, in wsgi_app
response = self.handle_exception(e)
File "F:\project\wxgzh\venv\lib\site-packages\flask\app.py", line 1455, in wsgi_app
response = self.full_dispatch_request()
File "F:\project\wxgzh\venv\lib\site-packages\flask\app.py", line 869, in full_dispatch_request
rv = self.handle_user_exception(e)
File "F:\project\wxgzh\venv\lib\site-packages\flask\app.py", line 867, in full_dispatch_request
rv = self.dispatch_request()
File "F:\project\wxgzh\venv\lib\site-packages\flask\app.py", line 852, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "F:\project\wxgzh\model_server.py", line 322, in get_new_content_api
new_content = get_new_content(engine_type,need_summary,need_keywords,content) # 传递 len 参数,使用 30 作为长度
File "F:\project\wxgzh\venv\lib\site-packages\decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "F:\project\wxgzh\venv\lib\site-packages\retry\api.py", line 73, in retry_decorator
return __retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter,
File "F:\project\wxgzh\venv\lib\site-packages\retry\api.py", line 33, in __retry_internal
return f()
File "F:\project\wxgzh\model_server.py", line 329, in get_new_content
new_content = get_new_content_chatglm(init_content)
File "F:\project\wxgzh\venv\lib\site-packages\decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "F:\project\wxgzh\venv\lib\site-packages\retry\api.py", line 73, in retry_decorator
return __retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter,
File "F:\project\wxgzh\venv\lib\site-packages\retry\api.py", line 33, in __retry_internal
return f()
File "F:\project\wxgzh\model_server.py", line 357, in get_new_content_chatglm
data = response.json()
File "F:\project\wxgzh\venv\lib\site-packages\requests\models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
</textarea>
</div>
<div class=”explanation”>
The debugger caught an exception in your WSGI application. You can now
look at the traceback which led to the error. <span class=”nojavascript”>
If you enable JavaScript you can also use additional features such as code
execution (if the evalex feature is enabled), automatic pasting of the
exceptions and much more.</span>
</div>
<div class=”footer”>
Brought to you by <strong class=”arthur”>DON’T PANIC</strong>, your
friendly Werkzeug powered traceback interpreter.
</div>
</div><div class=”pin-prompt”>
<div class=”inner”>
<h3>Console Locked</h3>
<p>
The console is locked and needs to be unlocked by entering the PIN.
You can find the PIN printed out on the standard output of your
shell that runs the server.
<form>
<p>PIN:
<input type=text name=pin size=14>
<input type=submit name=btn value=”Confirm Pin”>
</form>
</div>
</div>
</body>
</html><!–
Traceback (most recent call last):
File “F:\project\wxgzh\venv\lib\site-packages\requests\models.py”, line 971, in json
return complexjson.loads(self.text, **kwargs)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\json\__init__.py”, line 346, in loads
return _default_decoder.decode(s)
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\json\decoder.py”, line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\json\decoder.py”, line 355, in raw_decode
raise JSONDecodeError(“Expecting value”, s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “F:\project\wxgzh\venv\lib\site-packages\flask\app.py”, line 1478, in __call__
return self.wsgi_app(environ, start_response)
File “F:\project\wxgzh\venv\lib\site-packages\flask\app.py”, line 1458, in wsgi_app
response = self.handle_exception(e)
File “F:\project\wxgzh\venv\lib\site-packages\flask\app.py”, line 1455, in wsgi_app
response = self.full_dispatch_request()
File “F:\project\wxgzh\venv\lib\site-packages\flask\app.py”, line 869, in full_dispatch_request
rv = self.handle_user_exception(e)
File “F:\project\wxgzh\venv\lib\site-packages\flask\app.py”, line 867, in full_dispatch_request
rv = self.dispatch_request()
File “F:\project\wxgzh\venv\lib\site-packages\flask\app.py”, line 852, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File “F:\project\wxgzh\model_server.py”, line 322, in get_new_content_api
new_content = get_new_content(engine_type,need_summary,need_keywords,content) # 传递 len 参数,使用 30 作为长度
File “F:\project\wxgzh\venv\lib\site-packages\decorator.py”, line 232, in fun
return caller(func, *(extras + args), **kw)
File “F:\project\wxgzh\venv\lib\site-packages\retry\api.py”, line 73, in retry_decorator
return __retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter,
File “F:\project\wxgzh\venv\lib\site-packages\retry\api.py”, line 33, in __retry_internal
return f()
File “F:\project\wxgzh\model_server.py”, line 329, in get_new_content
new_content = get_new_content_chatglm(init_content)
File “F:\project\wxgzh\venv\lib\site-packages\decorator.py”, line 232, in fun
return caller(func, *(extras + args), **kw)
File “F:\project\wxgzh\venv\lib\site-packages\retry\api.py”, line 73, in retry_decorator
return __retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter,
File “F:\project\wxgzh\venv\lib\site-packages\retry\api.py”, line 33, in __retry_internal
return f()
File “F:\project\wxgzh\model_server.py”, line 357, in get_new_content_chatglm
data = response.json()
File “F:\project\wxgzh\venv\lib\site-packages\requests\models.py”, line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)–>
举报/反馈AI时代,拥有个人微信机器人AI助手!AI时代不落人后!
免费ChatGPT问答,办公、写作、生活好得力助手!
搜索微信号aigc666aigc999或上边扫码,即可拥有个人AI助手!
© Copyright notes文章版权归作者所有,未经允许请勿转载。