文章主题:AI画图软件, Midjourney, 官方中文版, 内测申请
出品|三言Pro 作者|DorAemon
<!doctype html> <html lang=en> <head> <title>requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002522554ABB0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) // 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>ConnectionError</h1> <div class=”detail”> <p class=”errormsg”>requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002522554ABB0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) </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-2551836936784″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”</cite>, line <em class=”line”>203</em>, in <code class=”function”>_new_conn</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>"""Establish a socket connection and set nodelay settings on it.</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>:return: New socket connection.</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>sock = connection.create_connection(</pre> <pre class=”line after”><span class=”ws”> </span>(self._dns_host, self.port),</pre> <pre class=”line after”><span class=”ws”> </span>self.timeout,</pre> <pre class=”line after”><span class=”ws”> </span>source_address=self.source_address,</pre> <pre class=”line after”><span class=”ws”> </span>socket_options=self.socket_options,</pre> <pre class=”line after”><span class=”ws”> </span>)</pre></div> </div> <li><div class=”frame” id=”frame-2551836936896″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py”</cite>, line <em class=”line”>85</em>, in <code class=”function”>create_connection</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>if sock is not None:</pre> <pre class=”line before”><span class=”ws”> </span>sock.close()</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>if err is not None:</pre> <pre class=”line before”><span class=”ws”> </span>try:</pre> <pre class=”line current”><span class=”ws”> </span>raise err</pre> <pre class=”line after”><span class=”ws”> </span>finally:</pre> <pre class=”line after”><span class=”ws”> </span># Break explicitly a reference cycle</pre> <pre class=”line after”><span class=”ws”> </span>err = None</pre> <pre class=”line after”><span class=”ws”> </span>else:</pre> <pre class=”line after”><span class=”ws”> </span>raise OSError("getaddrinfo returns an empty list")</pre></div> </div> <li><div class=”frame” id=”frame-2551836937008″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py”</cite>, line <em class=”line”>73</em>, in <code class=”function”>create_connection</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>if timeout is not _DEFAULT_TIMEOUT:</pre> <pre class=”line before”><span class=”ws”> </span>sock.settimeout(timeout)</pre> <pre class=”line before”><span class=”ws”> </span>if source_address:</pre> <pre class=”line before”><span class=”ws”> </span>sock.bind(source_address)</pre> <pre class=”line current”><span class=”ws”> </span>sock.connect(sa)</pre> <pre class=”line after”><span class=”ws”> </span># Break explicitly a reference cycle</pre> <pre class=”line after”><span class=”ws”> </span>err = None</pre> <pre class=”line after”><span class=”ws”> </span>return sock</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>except OSError as _:</pre></div> </div> <li><div class=”exc-divider”>The above exception was the direct cause of the following exception:</div> <li><div class=”frame” id=”frame-2551836935664″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”</cite>, line <em class=”line”>790</em>, in <code class=”function”>urlopen</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span># it will also try to release it and we'll have a double-release</pre> <pre class=”line before”><span class=”ws”> </span># mess.</pre> <pre class=”line before”><span class=”ws”> </span>response_conn = conn if not release_conn else None</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># Make the request on the HTTPConnection object</pre> <pre class=”line current”><span class=”ws”> </span>response = self._make_request(</pre> <pre class=”line after”><span class=”ws”> </span>conn,</pre> <pre class=”line after”><span class=”ws”> </span>method,</pre> <pre class=”line after”><span class=”ws”> </span>url,</pre> <pre class=”line after”><span class=”ws”> </span>timeout=timeout_obj,</pre> <pre class=”line after”><span class=”ws”> </span>body=body,</pre></div> </div> <li><div class=”frame” id=”frame-2551836935776″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”</cite>, line <em class=”line”>496</em>, in <code class=”function”>_make_request</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>raise new_e</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># conn.request() calls http.client.*.request, not the method in</pre> <pre class=”line before”><span class=”ws”> </span># urllib3.request. It also calls makefile (recv) on the socket.</pre> <pre class=”line before”><span class=”ws”> </span>try:</pre> <pre class=”line current”><span class=”ws”> </span>conn.request(</pre> <pre class=”line after”><span class=”ws”> </span>method,</pre> <pre class=”line after”><span class=”ws”> </span>url,</pre> <pre class=”line after”><span class=”ws”> </span>body=body,</pre> <pre class=”line after”><span class=”ws”> </span>headers=headers,</pre> <pre class=”line after”><span class=”ws”> </span>chunked=chunked,</pre></div> </div> <li><div class=”frame” id=”frame-2551836935888″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”</cite>, line <em class=”line”>395</em>, in <code class=”function”>request</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span># Now that framing headers are out of the way we send all the other headers.</pre> <pre class=”line before”><span class=”ws”> </span>if "user-agent" not in header_keys:</pre> <pre class=”line before”><span class=”ws”> </span>self.putheader("User-Agent", _get_default_user_agent())</pre> <pre class=”line before”><span class=”ws”> </span>for header, value in headers.items():</pre> <pre class=”line before”><span class=”ws”> </span>self.putheader(header, value)</pre> <pre class=”line current”><span class=”ws”> </span>self.endheaders()</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># If we're given a body we start sending that in chunks.</pre> <pre class=”line after”><span class=”ws”> </span>if chunks is not None:</pre> <pre class=”line after”><span class=”ws”> </span>for chunk in chunks:</pre> <pre class=”line after”><span class=”ws”> </span># Sending empty chunks isn't allowed for TE: chunked</pre></div> </div> <li><div class=”frame” id=”frame-2551836936000″> <h4>File <cite class=”filename”>”C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”</cite>, line <em class=”line”>1280</em>, in <code class=”function”>endheaders</code></h4> <div class=”source “><pre class=”line before”><span class=”ws”> </span>"""</pre> <pre class=”line before”><span class=”ws”> </span>if self.__state == _CS_REQ_STARTED:</pre> <pre class=”line before”><span class=”ws”> </span>self.__state = _CS_REQ_SENT</pre> <pre class=”line before”><span class=”ws”> </span>else:</pre> <pre class=”line before”><span class=”ws”> </span>raise CannotSendHeader()</pre> <pre class=”line current”><span class=”ws”> </span>self._send_output(message_body, encode_chunked=encode_chunked)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>def request(self, method, url, body=None, headers={}, *,</pre> <pre class=”line after”><span class=”ws”> </span>encode_chunked=False):</pre> <pre class=”line after”><span class=”ws”> </span>"""Send a complete request to the server."""</pre> <pre class=”line after”><span class=”ws”> </span>self._send_request(method, url, body, headers, encode_chunked)</pre></div> </div> <li><div class=”frame” id=”frame-2551836936224″> <h4>File <cite class=”filename”>”C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”</cite>, line <em class=”line”>1040</em>, in <code class=”function”>_send_output</code></h4> <div class=”source “><pre class=”line before”><span class=”ws”> </span>A message_body may be specified, to be appended to the request.</pre> <pre class=”line before”><span class=”ws”> </span>"""</pre> <pre class=”line before”><span class=”ws”> </span>self._buffer.extend((b"", b""))</pre> <pre class=”line before”><span class=”ws”> </span>msg = b"\r\n".join(self._buffer)</pre> <pre class=”line before”><span class=”ws”> </span>del self._buffer[:]</pre> <pre class=”line current”><span class=”ws”> </span>self.send(msg)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>if message_body is not None:</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># create a consistent interface to message_body</pre> <pre class=”line after”><span class=”ws”> </span>if hasattr(message_body, 'read'):</pre></div> </div> <li><div class=”frame” id=”frame-2551836936336″> <h4>File <cite class=”filename”>”C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”</cite>, line <em class=”line”>980</em>, in <code class=”function”>send</code></h4> <div class=”source “><pre class=”line before”><span class=”ws”> </span>file-like object that supports a .read() method, or an iterable object.</pre> <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>if self.sock is None:</pre> <pre class=”line before”><span class=”ws”> </span>if self.auto_open:</pre> <pre class=”line current”><span class=”ws”> </span>self.connect()</pre> <pre class=”line after”><span class=”ws”> </span>else:</pre> <pre class=”line after”><span class=”ws”> </span>raise NotConnected()</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>if self.debuglevel > 0:</pre> <pre class=”line after”><span class=”ws”> </span>print("send:", repr(data))</pre></div> </div> <li><div class=”frame” id=”frame-2551836936448″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”</cite>, line <em class=”line”>243</em>, in <code class=”function”>connect</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>)</pre> <pre class=”line before”><span class=”ws”> </span>super().set_tunnel(host, port=port, headers=headers)</pre> <pre class=”line before”><span class=”ws”> </span>self._tunnel_scheme = scheme</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>def connect(self) -> None:</pre> <pre class=”line current”><span class=”ws”> </span>self.sock = self._new_conn()</pre> <pre class=”line after”><span class=”ws”> </span>if self._tunnel_host:</pre> <pre class=”line after”><span class=”ws”> </span># If we're tunneling it means we're connected to our proxy.</pre> <pre class=”line after”><span class=”ws”> </span>self._has_connected_to_proxy = True</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># TODO: Fix tunnel so it doesn't depend on self.sock state.</pre></div> </div> <li><div class=”frame” id=”frame-2551836936560″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”</cite>, line <em class=”line”>218</em>, in <code class=”function”>_new_conn</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>self,</pre> <pre class=”line before”><span class=”ws”> </span>f"Connection to {self.host} timed out. (connect timeout={self.timeout})",</pre> <pre class=”line before”><span class=”ws”> </span>) from e</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>except OSError as e:</pre> <pre class=”line current”><span class=”ws”> </span>raise NewConnectionError(</pre> <pre class=”line after”><span class=”ws”> </span>self, f"Failed to establish a new connection: {e}"</pre> <pre class=”line after”><span class=”ws”> </span>) from e</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># Audit hooks are only available in Python 3.8+</pre> <pre class=”line after”><span class=”ws”> </span>if _HAS_SYS_AUDIT:</pre></div> </div> <li><div class=”exc-divider”>The above exception was the direct cause of the following exception:</div> <li><div class=”frame” id=”frame-2551836935216″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py”</cite>, line <em class=”line”>486</em>, in <code class=”function”>send</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>pass</pre> <pre class=”line before”><span class=”ws”> </span>else:</pre> <pre class=”line before”><span class=”ws”> </span>timeout = TimeoutSauce(connect=timeout, read=timeout)</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>resp = conn.urlopen(</pre> <pre class=”line after”><span class=”ws”> </span>method=request.method,</pre> <pre class=”line after”><span class=”ws”> </span>url=url,</pre> <pre class=”line after”><span class=”ws”> </span>body=request.body,</pre> <pre class=”line after”><span class=”ws”> </span>headers=request.headers,</pre> <pre class=”line after”><span class=”ws”> </span>redirect=False,</pre></div> </div> <li><div class=”frame” id=”frame-2551836935328″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”</cite>, line <em class=”line”>844</em>, in <code class=”function”>urlopen</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>) and (conn and conn.proxy and not conn.has_connected_to_proxy):</pre> <pre class=”line before”><span class=”ws”> </span>new_e = _wrap_proxy_error(new_e, conn.proxy.scheme)</pre> <pre class=”line before”><span class=”ws”> </span>elif isinstance(new_e, (OSError, HTTPException)):</pre> <pre class=”line before”><span class=”ws”> </span>new_e = ProtocolError("Connection aborted.", new_e)</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line current”><span class=”ws”> </span>retries = retries.increment(</pre> <pre class=”line after”><span class=”ws”> </span>method, url, error=new_e, _pool=self, _stacktrace=sys.exc_info()[2]</pre> <pre class=”line after”><span class=”ws”> </span>)</pre> <pre class=”line after”><span class=”ws”> </span>retries.sleep()</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># Keep track of the error for the retry warning.</pre></div> </div> <li><div class=”frame” id=”frame-2551836935440″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\util\retry.py”</cite>, line <em class=”line”>515</em>, in <code class=”function”>increment</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>history=history,</pre> <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>if new_retry.is_exhausted():</pre> <pre class=”line before”><span class=”ws”> </span>reason = error or ResponseError(cause)</pre> <pre class=”line current”><span class=”ws”> </span>raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>log.debug("Incremented Retry for (url='%s'): %r", url, new_retry)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>return new_retry</pre> <pre class=”line after”><span class=”ws”></span> </pre></div> </div> <li><div class=”exc-divider”>During handling of the above exception, another exception occurred:</div> <li><div class=”frame” id=”frame-2551836867488″> <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-2551836867376″> <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-2551836867264″> <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-2551836867600″> <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-2551836867712″> <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-2551836867824″> <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-2551836867936″> <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-2551836868048″> <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-2551836868160″> <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-2551836868272″> <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-2551836868384″> <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-2551836934208″> <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-2551836934320″> <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-2551836934432″> <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-2551836934544″> <h4>File <cite class=”filename”>”F:\project\wxgzh\model_server.py”</cite>, line <em class=”line”>355</em>, in <code class=”function”>get_new_content_chatglm</code></h4> <div class=”source “><pre class=”line before”><span class=”ws”> </span>"functions": {},</pre> <pre class=”line before”><span class=”ws”> </span>"repetition_penalty": 1.1</pre> <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 current”><span class=”ws”> </span>response = requests.request("POST", chatglm_url, json=payload, headers=headers)</pre> <pre class=”line after”><span class=”ws”> </span>#print(response)</pre> <pre class=”line after”><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></div> </div> <li><div class=”frame” id=”frame-2551836934656″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\api.py”</cite>, line <em class=”line”>59</em>, in <code class=”function”>request</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># By using the 'with' statement we are sure the session is closed, thus we</pre> <pre class=”line before”><span class=”ws”> </span># avoid leaving sockets open which can trigger a ResourceWarning in some</pre> <pre class=”line before”><span class=”ws”> </span># cases, and look like a memory leak in others.</pre> <pre class=”line before”><span class=”ws”> </span>with sessions.Session() as session:</pre> <pre class=”line current”><span class=”ws”> </span>return session.request(method=method, url=url, **kwargs)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”></span>def get(url, params=None, **kwargs):</pre> <pre class=”line after”><span class=”ws”> </span>r"""Sends a GET request.</pre> <pre class=”line after”><span class=”ws”></span> </pre></div> </div> <li><div class=”frame” id=”frame-2551836934880″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py”</cite>, line <em class=”line”>589</em>, in <code class=”function”>request</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>send_kwargs = {</pre> <pre class=”line before”><span class=”ws”> </span>"timeout": timeout,</pre> <pre class=”line before”><span class=”ws”> </span>"allow_redirects": allow_redirects,</pre> <pre class=”line before”><span class=”ws”> </span>}</pre> <pre class=”line before”><span class=”ws”> </span>send_kwargs.update(settings)</pre> <pre class=”line current”><span class=”ws”> </span>resp = self.send(prep, **send_kwargs)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>return resp</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>def get(self, url, **kwargs):</pre> <pre class=”line after”><span class=”ws”> </span>r"""Sends a GET request. Returns :class:`Response` object.</pre></div> </div> <li><div class=”frame” id=”frame-2551836934992″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py”</cite>, line <em class=”line”>703</em>, in <code class=”function”>send</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># Start time (approximately) of the request</pre> <pre class=”line before”><span class=”ws”> </span>start = preferred_clock()</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># Send the request</pre> <pre class=”line current”><span class=”ws”> </span>r = adapter.send(request, **kwargs)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># Total elapsed time of the request (approximately)</pre> <pre class=”line after”><span class=”ws”> </span>elapsed = preferred_clock() – start</pre> <pre class=”line after”><span class=”ws”> </span>r.elapsed = timedelta(seconds=elapsed)</pre> <pre class=”line after”><span class=”ws”></span> </pre></div> </div> <li><div class=”frame” id=”frame-2551836935104″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py”</cite>, line <em class=”line”>519</em>, in <code class=”function”>send</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>if isinstance(e.reason, _SSLError):</pre> <pre class=”line before”><span class=”ws”> </span># This branch is for urllib3 v1.22 and later.</pre> <pre class=”line before”><span class=”ws”> </span>raise SSLError(e, request=request)</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line current”><span class=”ws”> </span>raise ConnectionError(e, request=request)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>except ClosedPoolError as e:</pre> <pre class=”line after”><span class=”ws”> </span>raise ConnectionError(e, request=request)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>except _ProxyError as e:</pre></div> </div> </ul> <blockquote>requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002522554ABB0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) </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\urllib3\connection.py", line 203, in _new_conn sock = connection.create_connection( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py", line 85, in create_connection raise err File "F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py", line 73, in create_connection sock.connect(sa) ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py", line 790, in urlopen response = self._make_request( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py", line 496, in _make_request conn.request( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py", line 395, in request self.endheaders() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1280, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1040, in _send_output self.send(msg) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 980, in send self.connect() File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py", line 243, in connect self.sock = self._new_conn() File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py", line 218, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x000002522554ABB0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File "F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py", line 486, in send resp = conn.urlopen( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py", line 844, in urlopen retries = retries.increment( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\util\retry.py", line 515, in increment raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002522554ABB0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) 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 355, in get_new_content_chatglm response = requests.request("POST", chatglm_url, json=payload, headers=headers) File "F:\project\wxgzh\venv\lib\site-packages\requests\api.py", line 59, in request return session.request(method=method, url=url, **kwargs) File "F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py", line 589, in request resp = self.send(prep, **send_kwargs) File "F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py", line 703, in send r = adapter.send(request, **kwargs) File "F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py", line 519, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002522554ABB0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) </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\urllib3\connection.py”, line 203, in _new_conn sock = connection.create_connection( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py”, line 85, in create_connection raise err File “F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py”, line 73, in create_connection sock.connect(sa) ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”, line 790, in urlopen response = self._make_request( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”, line 496, in _make_request conn.request( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”, line 395, in request self.endheaders() File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”, line 1280, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”, line 1040, in _send_output self.send(msg) File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”, line 980, in send self.connect() File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”, line 243, in connect self.sock = self._new_conn() File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”, line 218, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x000002522554ABB0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File “F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py”, line 486, in send resp = conn.urlopen( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”, line 844, in urlopen retries = retries.increment( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\util\retry.py”, line 515, in increment raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host=’127.0.0.1′, port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0x000002522554ABB0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。’)) 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 355, in get_new_content_chatglm response = requests.request(“POST”, chatglm_url, json=payload, headers=headers) File “F:\project\wxgzh\venv\lib\site-packages\requests\api.py”, line 59, in request return session.request(method=method, url=url, **kwargs) File “F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py”, line 589, in request resp = self.send(prep, **send_kwargs) File “F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py”, line 703, in send r = adapter.send(request, **kwargs) File “F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py”, line 519, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host=’127.0.0.1′, port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0x000002522554ABB0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。’)) –>
<!doctype html> <html lang=en> <head> <title>requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000025225569E50>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) // 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>ConnectionError</h1> <div class=”detail”> <p class=”errormsg”>requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000025225569E50>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) </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-2551837056016″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”</cite>, line <em class=”line”>203</em>, in <code class=”function”>_new_conn</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>"""Establish a socket connection and set nodelay settings on it.</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>:return: New socket connection.</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>sock = connection.create_connection(</pre> <pre class=”line after”><span class=”ws”> </span>(self._dns_host, self.port),</pre> <pre class=”line after”><span class=”ws”> </span>self.timeout,</pre> <pre class=”line after”><span class=”ws”> </span>source_address=self.source_address,</pre> <pre class=”line after”><span class=”ws”> </span>socket_options=self.socket_options,</pre> <pre class=”line after”><span class=”ws”> </span>)</pre></div> </div> <li><div class=”frame” id=”frame-2551837056128″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py”</cite>, line <em class=”line”>85</em>, in <code class=”function”>create_connection</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>if sock is not None:</pre> <pre class=”line before”><span class=”ws”> </span>sock.close()</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>if err is not None:</pre> <pre class=”line before”><span class=”ws”> </span>try:</pre> <pre class=”line current”><span class=”ws”> </span>raise err</pre> <pre class=”line after”><span class=”ws”> </span>finally:</pre> <pre class=”line after”><span class=”ws”> </span># Break explicitly a reference cycle</pre> <pre class=”line after”><span class=”ws”> </span>err = None</pre> <pre class=”line after”><span class=”ws”> </span>else:</pre> <pre class=”line after”><span class=”ws”> </span>raise OSError("getaddrinfo returns an empty list")</pre></div> </div> <li><div class=”frame” id=”frame-2551837056240″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py”</cite>, line <em class=”line”>73</em>, in <code class=”function”>create_connection</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>if timeout is not _DEFAULT_TIMEOUT:</pre> <pre class=”line before”><span class=”ws”> </span>sock.settimeout(timeout)</pre> <pre class=”line before”><span class=”ws”> </span>if source_address:</pre> <pre class=”line before”><span class=”ws”> </span>sock.bind(source_address)</pre> <pre class=”line current”><span class=”ws”> </span>sock.connect(sa)</pre> <pre class=”line after”><span class=”ws”> </span># Break explicitly a reference cycle</pre> <pre class=”line after”><span class=”ws”> </span>err = None</pre> <pre class=”line after”><span class=”ws”> </span>return sock</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>except OSError as _:</pre></div> </div> <li><div class=”exc-divider”>The above exception was the direct cause of the following exception:</div> <li><div class=”frame” id=”frame-2551837054896″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”</cite>, line <em class=”line”>790</em>, in <code class=”function”>urlopen</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span># it will also try to release it and we'll have a double-release</pre> <pre class=”line before”><span class=”ws”> </span># mess.</pre> <pre class=”line before”><span class=”ws”> </span>response_conn = conn if not release_conn else None</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># Make the request on the HTTPConnection object</pre> <pre class=”line current”><span class=”ws”> </span>response = self._make_request(</pre> <pre class=”line after”><span class=”ws”> </span>conn,</pre> <pre class=”line after”><span class=”ws”> </span>method,</pre> <pre class=”line after”><span class=”ws”> </span>url,</pre> <pre class=”line after”><span class=”ws”> </span>timeout=timeout_obj,</pre> <pre class=”line after”><span class=”ws”> </span>body=body,</pre></div> </div> <li><div class=”frame” id=”frame-2551837055008″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”</cite>, line <em class=”line”>496</em>, in <code class=”function”>_make_request</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>raise new_e</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># conn.request() calls http.client.*.request, not the method in</pre> <pre class=”line before”><span class=”ws”> </span># urllib3.request. It also calls makefile (recv) on the socket.</pre> <pre class=”line before”><span class=”ws”> </span>try:</pre> <pre class=”line current”><span class=”ws”> </span>conn.request(</pre> <pre class=”line after”><span class=”ws”> </span>method,</pre> <pre class=”line after”><span class=”ws”> </span>url,</pre> <pre class=”line after”><span class=”ws”> </span>body=body,</pre> <pre class=”line after”><span class=”ws”> </span>headers=headers,</pre> <pre class=”line after”><span class=”ws”> </span>chunked=chunked,</pre></div> </div> <li><div class=”frame” id=”frame-2551837055120″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”</cite>, line <em class=”line”>395</em>, in <code class=”function”>request</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span># Now that framing headers are out of the way we send all the other headers.</pre> <pre class=”line before”><span class=”ws”> </span>if "user-agent" not in header_keys:</pre> <pre class=”line before”><span class=”ws”> </span>self.putheader("User-Agent", _get_default_user_agent())</pre> <pre class=”line before”><span class=”ws”> </span>for header, value in headers.items():</pre> <pre class=”line before”><span class=”ws”> </span>self.putheader(header, value)</pre> <pre class=”line current”><span class=”ws”> </span>self.endheaders()</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># If we're given a body we start sending that in chunks.</pre> <pre class=”line after”><span class=”ws”> </span>if chunks is not None:</pre> <pre class=”line after”><span class=”ws”> </span>for chunk in chunks:</pre> <pre class=”line after”><span class=”ws”> </span># Sending empty chunks isn't allowed for TE: chunked</pre></div> </div> <li><div class=”frame” id=”frame-2551837055232″> <h4>File <cite class=”filename”>”C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”</cite>, line <em class=”line”>1280</em>, in <code class=”function”>endheaders</code></h4> <div class=”source “><pre class=”line before”><span class=”ws”> </span>"""</pre> <pre class=”line before”><span class=”ws”> </span>if self.__state == _CS_REQ_STARTED:</pre> <pre class=”line before”><span class=”ws”> </span>self.__state = _CS_REQ_SENT</pre> <pre class=”line before”><span class=”ws”> </span>else:</pre> <pre class=”line before”><span class=”ws”> </span>raise CannotSendHeader()</pre> <pre class=”line current”><span class=”ws”> </span>self._send_output(message_body, encode_chunked=encode_chunked)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>def request(self, method, url, body=None, headers={}, *,</pre> <pre class=”line after”><span class=”ws”> </span>encode_chunked=False):</pre> <pre class=”line after”><span class=”ws”> </span>"""Send a complete request to the server."""</pre> <pre class=”line after”><span class=”ws”> </span>self._send_request(method, url, body, headers, encode_chunked)</pre></div> </div> <li><div class=”frame” id=”frame-2551837055456″> <h4>File <cite class=”filename”>”C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”</cite>, line <em class=”line”>1040</em>, in <code class=”function”>_send_output</code></h4> <div class=”source “><pre class=”line before”><span class=”ws”> </span>A message_body may be specified, to be appended to the request.</pre> <pre class=”line before”><span class=”ws”> </span>"""</pre> <pre class=”line before”><span class=”ws”> </span>self._buffer.extend((b"", b""))</pre> <pre class=”line before”><span class=”ws”> </span>msg = b"\r\n".join(self._buffer)</pre> <pre class=”line before”><span class=”ws”> </span>del self._buffer[:]</pre> <pre class=”line current”><span class=”ws”> </span>self.send(msg)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>if message_body is not None:</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># create a consistent interface to message_body</pre> <pre class=”line after”><span class=”ws”> </span>if hasattr(message_body, 'read'):</pre></div> </div> <li><div class=”frame” id=”frame-2551837055568″> <h4>File <cite class=”filename”>”C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”</cite>, line <em class=”line”>980</em>, in <code class=”function”>send</code></h4> <div class=”source “><pre class=”line before”><span class=”ws”> </span>file-like object that supports a .read() method, or an iterable object.</pre> <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>if self.sock is None:</pre> <pre class=”line before”><span class=”ws”> </span>if self.auto_open:</pre> <pre class=”line current”><span class=”ws”> </span>self.connect()</pre> <pre class=”line after”><span class=”ws”> </span>else:</pre> <pre class=”line after”><span class=”ws”> </span>raise NotConnected()</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>if self.debuglevel > 0:</pre> <pre class=”line after”><span class=”ws”> </span>print("send:", repr(data))</pre></div> </div> <li><div class=”frame” id=”frame-2551837055680″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”</cite>, line <em class=”line”>243</em>, in <code class=”function”>connect</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>)</pre> <pre class=”line before”><span class=”ws”> </span>super().set_tunnel(host, port=port, headers=headers)</pre> <pre class=”line before”><span class=”ws”> </span>self._tunnel_scheme = scheme</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>def connect(self) -> None:</pre> <pre class=”line current”><span class=”ws”> </span>self.sock = self._new_conn()</pre> <pre class=”line after”><span class=”ws”> </span>if self._tunnel_host:</pre> <pre class=”line after”><span class=”ws”> </span># If we're tunneling it means we're connected to our proxy.</pre> <pre class=”line after”><span class=”ws”> </span>self._has_connected_to_proxy = True</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># TODO: Fix tunnel so it doesn't depend on self.sock state.</pre></div> </div> <li><div class=”frame” id=”frame-2551837055792″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”</cite>, line <em class=”line”>218</em>, in <code class=”function”>_new_conn</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>self,</pre> <pre class=”line before”><span class=”ws”> </span>f"Connection to {self.host} timed out. (connect timeout={self.timeout})",</pre> <pre class=”line before”><span class=”ws”> </span>) from e</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>except OSError as e:</pre> <pre class=”line current”><span class=”ws”> </span>raise NewConnectionError(</pre> <pre class=”line after”><span class=”ws”> </span>self, f"Failed to establish a new connection: {e}"</pre> <pre class=”line after”><span class=”ws”> </span>) from e</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># Audit hooks are only available in Python 3.8+</pre> <pre class=”line after”><span class=”ws”> </span>if _HAS_SYS_AUDIT:</pre></div> </div> <li><div class=”exc-divider”>The above exception was the direct cause of the following exception:</div> <li><div class=”frame” id=”frame-2551837054448″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py”</cite>, line <em class=”line”>486</em>, in <code class=”function”>send</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>pass</pre> <pre class=”line before”><span class=”ws”> </span>else:</pre> <pre class=”line before”><span class=”ws”> </span>timeout = TimeoutSauce(connect=timeout, read=timeout)</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>resp = conn.urlopen(</pre> <pre class=”line after”><span class=”ws”> </span>method=request.method,</pre> <pre class=”line after”><span class=”ws”> </span>url=url,</pre> <pre class=”line after”><span class=”ws”> </span>body=request.body,</pre> <pre class=”line after”><span class=”ws”> </span>headers=request.headers,</pre> <pre class=”line after”><span class=”ws”> </span>redirect=False,</pre></div> </div> <li><div class=”frame” id=”frame-2551837054560″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”</cite>, line <em class=”line”>844</em>, in <code class=”function”>urlopen</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>) and (conn and conn.proxy and not conn.has_connected_to_proxy):</pre> <pre class=”line before”><span class=”ws”> </span>new_e = _wrap_proxy_error(new_e, conn.proxy.scheme)</pre> <pre class=”line before”><span class=”ws”> </span>elif isinstance(new_e, (OSError, HTTPException)):</pre> <pre class=”line before”><span class=”ws”> </span>new_e = ProtocolError("Connection aborted.", new_e)</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line current”><span class=”ws”> </span>retries = retries.increment(</pre> <pre class=”line after”><span class=”ws”> </span>method, url, error=new_e, _pool=self, _stacktrace=sys.exc_info()[2]</pre> <pre class=”line after”><span class=”ws”> </span>)</pre> <pre class=”line after”><span class=”ws”> </span>retries.sleep()</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># Keep track of the error for the retry warning.</pre></div> </div> <li><div class=”frame” id=”frame-2551837054672″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\util\retry.py”</cite>, line <em class=”line”>515</em>, in <code class=”function”>increment</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>history=history,</pre> <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>if new_retry.is_exhausted():</pre> <pre class=”line before”><span class=”ws”> </span>reason = error or ResponseError(cause)</pre> <pre class=”line current”><span class=”ws”> </span>raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>log.debug("Incremented Retry for (url='%s'): %r", url, new_retry)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>return new_retry</pre> <pre class=”line after”><span class=”ws”></span> </pre></div> </div> <li><div class=”exc-divider”>During handling of the above exception, another exception occurred:</div> <li><div class=”frame” id=”frame-2551837003104″> <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-2551837001312″> <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-2551837002992″> <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-2551837003216″> <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-2551837003328″> <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-2551837003440″> <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-2551837003552″> <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-2551837003664″> <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-2551837052992″> <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-2551837053104″> <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-2551837053216″> <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-2551837053440″> <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-2551837053552″> <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-2551837053664″> <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-2551837053776″> <h4>File <cite class=”filename”>”F:\project\wxgzh\model_server.py”</cite>, line <em class=”line”>355</em>, in <code class=”function”>get_new_content_chatglm</code></h4> <div class=”source “><pre class=”line before”><span class=”ws”> </span>"functions": {},</pre> <pre class=”line before”><span class=”ws”> </span>"repetition_penalty": 1.1</pre> <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 current”><span class=”ws”> </span>response = requests.request("POST", chatglm_url, json=payload, headers=headers)</pre> <pre class=”line after”><span class=”ws”> </span>#print(response)</pre> <pre class=”line after”><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></div> </div> <li><div class=”frame” id=”frame-2551837053888″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\api.py”</cite>, line <em class=”line”>59</em>, in <code class=”function”>request</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># By using the 'with' statement we are sure the session is closed, thus we</pre> <pre class=”line before”><span class=”ws”> </span># avoid leaving sockets open which can trigger a ResourceWarning in some</pre> <pre class=”line before”><span class=”ws”> </span># cases, and look like a memory leak in others.</pre> <pre class=”line before”><span class=”ws”> </span>with sessions.Session() as session:</pre> <pre class=”line current”><span class=”ws”> </span>return session.request(method=method, url=url, **kwargs)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”></span>def get(url, params=None, **kwargs):</pre> <pre class=”line after”><span class=”ws”> </span>r"""Sends a GET request.</pre> <pre class=”line after”><span class=”ws”></span> </pre></div> </div> <li><div class=”frame” id=”frame-2551837054112″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py”</cite>, line <em class=”line”>589</em>, in <code class=”function”>request</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>send_kwargs = {</pre> <pre class=”line before”><span class=”ws”> </span>"timeout": timeout,</pre> <pre class=”line before”><span class=”ws”> </span>"allow_redirects": allow_redirects,</pre> <pre class=”line before”><span class=”ws”> </span>}</pre> <pre class=”line before”><span class=”ws”> </span>send_kwargs.update(settings)</pre> <pre class=”line current”><span class=”ws”> </span>resp = self.send(prep, **send_kwargs)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>return resp</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>def get(self, url, **kwargs):</pre> <pre class=”line after”><span class=”ws”> </span>r"""Sends a GET request. Returns :class:`Response` object.</pre></div> </div> <li><div class=”frame” id=”frame-2551837054224″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py”</cite>, line <em class=”line”>703</em>, in <code class=”function”>send</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># Start time (approximately) of the request</pre> <pre class=”line before”><span class=”ws”> </span>start = preferred_clock()</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># Send the request</pre> <pre class=”line current”><span class=”ws”> </span>r = adapter.send(request, **kwargs)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># Total elapsed time of the request (approximately)</pre> <pre class=”line after”><span class=”ws”> </span>elapsed = preferred_clock() – start</pre> <pre class=”line after”><span class=”ws”> </span>r.elapsed = timedelta(seconds=elapsed)</pre> <pre class=”line after”><span class=”ws”></span> </pre></div> </div> <li><div class=”frame” id=”frame-2551837054336″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py”</cite>, line <em class=”line”>519</em>, in <code class=”function”>send</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>if isinstance(e.reason, _SSLError):</pre> <pre class=”line before”><span class=”ws”> </span># This branch is for urllib3 v1.22 and later.</pre> <pre class=”line before”><span class=”ws”> </span>raise SSLError(e, request=request)</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line current”><span class=”ws”> </span>raise ConnectionError(e, request=request)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>except ClosedPoolError as e:</pre> <pre class=”line after”><span class=”ws”> </span>raise ConnectionError(e, request=request)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>except _ProxyError as e:</pre></div> </div> </ul> <blockquote>requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000025225569E50>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) </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\urllib3\connection.py", line 203, in _new_conn sock = connection.create_connection( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py", line 85, in create_connection raise err File "F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py", line 73, in create_connection sock.connect(sa) ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py", line 790, in urlopen response = self._make_request( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py", line 496, in _make_request conn.request( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py", line 395, in request self.endheaders() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1280, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1040, in _send_output self.send(msg) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 980, in send self.connect() File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py", line 243, in connect self.sock = self._new_conn() File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py", line 218, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x0000025225569E50>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File "F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py", line 486, in send resp = conn.urlopen( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py", line 844, in urlopen retries = retries.increment( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\util\retry.py", line 515, in increment raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000025225569E50>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) 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 355, in get_new_content_chatglm response = requests.request("POST", chatglm_url, json=payload, headers=headers) File "F:\project\wxgzh\venv\lib\site-packages\requests\api.py", line 59, in request return session.request(method=method, url=url, **kwargs) File "F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py", line 589, in request resp = self.send(prep, **send_kwargs) File "F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py", line 703, in send r = adapter.send(request, **kwargs) File "F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py", line 519, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000025225569E50>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) </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\urllib3\connection.py”, line 203, in _new_conn sock = connection.create_connection( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py”, line 85, in create_connection raise err File “F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py”, line 73, in create_connection sock.connect(sa) ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”, line 790, in urlopen response = self._make_request( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”, line 496, in _make_request conn.request( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”, line 395, in request self.endheaders() File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”, line 1280, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”, line 1040, in _send_output self.send(msg) File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”, line 980, in send self.connect() File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”, line 243, in connect self.sock = self._new_conn() File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”, line 218, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x0000025225569E50>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File “F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py”, line 486, in send resp = conn.urlopen( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”, line 844, in urlopen retries = retries.increment( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\util\retry.py”, line 515, in increment raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host=’127.0.0.1′, port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0x0000025225569E50>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。’)) 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 355, in get_new_content_chatglm response = requests.request(“POST”, chatglm_url, json=payload, headers=headers) File “F:\project\wxgzh\venv\lib\site-packages\requests\api.py”, line 59, in request return session.request(method=method, url=url, **kwargs) File “F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py”, line 589, in request resp = self.send(prep, **send_kwargs) File “F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py”, line 703, in send r = adapter.send(request, **kwargs) File “F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py”, line 519, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host=’127.0.0.1′, port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0x0000025225569E50>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。’)) –>
<!doctype html> <html lang=en> <head> <title>requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002522558C340>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) // 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>ConnectionError</h1> <div class=”detail”> <p class=”errormsg”>requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002522558C340>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) </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-2551837179344″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”</cite>, line <em class=”line”>203</em>, in <code class=”function”>_new_conn</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>"""Establish a socket connection and set nodelay settings on it.</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>:return: New socket connection.</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>sock = connection.create_connection(</pre> <pre class=”line after”><span class=”ws”> </span>(self._dns_host, self.port),</pre> <pre class=”line after”><span class=”ws”> </span>self.timeout,</pre> <pre class=”line after”><span class=”ws”> </span>source_address=self.source_address,</pre> <pre class=”line after”><span class=”ws”> </span>socket_options=self.socket_options,</pre> <pre class=”line after”><span class=”ws”> </span>)</pre></div> </div> <li><div class=”frame” id=”frame-2551837179456″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py”</cite>, line <em class=”line”>85</em>, in <code class=”function”>create_connection</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>if sock is not None:</pre> <pre class=”line before”><span class=”ws”> </span>sock.close()</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>if err is not None:</pre> <pre class=”line before”><span class=”ws”> </span>try:</pre> <pre class=”line current”><span class=”ws”> </span>raise err</pre> <pre class=”line after”><span class=”ws”> </span>finally:</pre> <pre class=”line after”><span class=”ws”> </span># Break explicitly a reference cycle</pre> <pre class=”line after”><span class=”ws”> </span>err = None</pre> <pre class=”line after”><span class=”ws”> </span>else:</pre> <pre class=”line after”><span class=”ws”> </span>raise OSError("getaddrinfo returns an empty list")</pre></div> </div> <li><div class=”frame” id=”frame-2551837179568″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py”</cite>, line <em class=”line”>73</em>, in <code class=”function”>create_connection</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>if timeout is not _DEFAULT_TIMEOUT:</pre> <pre class=”line before”><span class=”ws”> </span>sock.settimeout(timeout)</pre> <pre class=”line before”><span class=”ws”> </span>if source_address:</pre> <pre class=”line before”><span class=”ws”> </span>sock.bind(source_address)</pre> <pre class=”line current”><span class=”ws”> </span>sock.connect(sa)</pre> <pre class=”line after”><span class=”ws”> </span># Break explicitly a reference cycle</pre> <pre class=”line after”><span class=”ws”> </span>err = None</pre> <pre class=”line after”><span class=”ws”> </span>return sock</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>except OSError as _:</pre></div> </div> <li><div class=”exc-divider”>The above exception was the direct cause of the following exception:</div> <li><div class=”frame” id=”frame-2551837178224″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”</cite>, line <em class=”line”>790</em>, in <code class=”function”>urlopen</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span># it will also try to release it and we'll have a double-release</pre> <pre class=”line before”><span class=”ws”> </span># mess.</pre> <pre class=”line before”><span class=”ws”> </span>response_conn = conn if not release_conn else None</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># Make the request on the HTTPConnection object</pre> <pre class=”line current”><span class=”ws”> </span>response = self._make_request(</pre> <pre class=”line after”><span class=”ws”> </span>conn,</pre> <pre class=”line after”><span class=”ws”> </span>method,</pre> <pre class=”line after”><span class=”ws”> </span>url,</pre> <pre class=”line after”><span class=”ws”> </span>timeout=timeout_obj,</pre> <pre class=”line after”><span class=”ws”> </span>body=body,</pre></div> </div> <li><div class=”frame” id=”frame-2551837178336″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”</cite>, line <em class=”line”>496</em>, in <code class=”function”>_make_request</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>raise new_e</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># conn.request() calls http.client.*.request, not the method in</pre> <pre class=”line before”><span class=”ws”> </span># urllib3.request. It also calls makefile (recv) on the socket.</pre> <pre class=”line before”><span class=”ws”> </span>try:</pre> <pre class=”line current”><span class=”ws”> </span>conn.request(</pre> <pre class=”line after”><span class=”ws”> </span>method,</pre> <pre class=”line after”><span class=”ws”> </span>url,</pre> <pre class=”line after”><span class=”ws”> </span>body=body,</pre> <pre class=”line after”><span class=”ws”> </span>headers=headers,</pre> <pre class=”line after”><span class=”ws”> </span>chunked=chunked,</pre></div> </div> <li><div class=”frame” id=”frame-2551837178448″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”</cite>, line <em class=”line”>395</em>, in <code class=”function”>request</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span># Now that framing headers are out of the way we send all the other headers.</pre> <pre class=”line before”><span class=”ws”> </span>if "user-agent" not in header_keys:</pre> <pre class=”line before”><span class=”ws”> </span>self.putheader("User-Agent", _get_default_user_agent())</pre> <pre class=”line before”><span class=”ws”> </span>for header, value in headers.items():</pre> <pre class=”line before”><span class=”ws”> </span>self.putheader(header, value)</pre> <pre class=”line current”><span class=”ws”> </span>self.endheaders()</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># If we're given a body we start sending that in chunks.</pre> <pre class=”line after”><span class=”ws”> </span>if chunks is not None:</pre> <pre class=”line after”><span class=”ws”> </span>for chunk in chunks:</pre> <pre class=”line after”><span class=”ws”> </span># Sending empty chunks isn't allowed for TE: chunked</pre></div> </div> <li><div class=”frame” id=”frame-2551837178560″> <h4>File <cite class=”filename”>”C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”</cite>, line <em class=”line”>1280</em>, in <code class=”function”>endheaders</code></h4> <div class=”source “><pre class=”line before”><span class=”ws”> </span>"""</pre> <pre class=”line before”><span class=”ws”> </span>if self.__state == _CS_REQ_STARTED:</pre> <pre class=”line before”><span class=”ws”> </span>self.__state = _CS_REQ_SENT</pre> <pre class=”line before”><span class=”ws”> </span>else:</pre> <pre class=”line before”><span class=”ws”> </span>raise CannotSendHeader()</pre> <pre class=”line current”><span class=”ws”> </span>self._send_output(message_body, encode_chunked=encode_chunked)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>def request(self, method, url, body=None, headers={}, *,</pre> <pre class=”line after”><span class=”ws”> </span>encode_chunked=False):</pre> <pre class=”line after”><span class=”ws”> </span>"""Send a complete request to the server."""</pre> <pre class=”line after”><span class=”ws”> </span>self._send_request(method, url, body, headers, encode_chunked)</pre></div> </div> <li><div class=”frame” id=”frame-2551837178784″> <h4>File <cite class=”filename”>”C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”</cite>, line <em class=”line”>1040</em>, in <code class=”function”>_send_output</code></h4> <div class=”source “><pre class=”line before”><span class=”ws”> </span>A message_body may be specified, to be appended to the request.</pre> <pre class=”line before”><span class=”ws”> </span>"""</pre> <pre class=”line before”><span class=”ws”> </span>self._buffer.extend((b"", b""))</pre> <pre class=”line before”><span class=”ws”> </span>msg = b"\r\n".join(self._buffer)</pre> <pre class=”line before”><span class=”ws”> </span>del self._buffer[:]</pre> <pre class=”line current”><span class=”ws”> </span>self.send(msg)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>if message_body is not None:</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># create a consistent interface to message_body</pre> <pre class=”line after”><span class=”ws”> </span>if hasattr(message_body, 'read'):</pre></div> </div> <li><div class=”frame” id=”frame-2551837178896″> <h4>File <cite class=”filename”>”C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”</cite>, line <em class=”line”>980</em>, in <code class=”function”>send</code></h4> <div class=”source “><pre class=”line before”><span class=”ws”> </span>file-like object that supports a .read() method, or an iterable object.</pre> <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>if self.sock is None:</pre> <pre class=”line before”><span class=”ws”> </span>if self.auto_open:</pre> <pre class=”line current”><span class=”ws”> </span>self.connect()</pre> <pre class=”line after”><span class=”ws”> </span>else:</pre> <pre class=”line after”><span class=”ws”> </span>raise NotConnected()</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>if self.debuglevel > 0:</pre> <pre class=”line after”><span class=”ws”> </span>print("send:", repr(data))</pre></div> </div> <li><div class=”frame” id=”frame-2551837179008″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”</cite>, line <em class=”line”>243</em>, in <code class=”function”>connect</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>)</pre> <pre class=”line before”><span class=”ws”> </span>super().set_tunnel(host, port=port, headers=headers)</pre> <pre class=”line before”><span class=”ws”> </span>self._tunnel_scheme = scheme</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>def connect(self) -> None:</pre> <pre class=”line current”><span class=”ws”> </span>self.sock = self._new_conn()</pre> <pre class=”line after”><span class=”ws”> </span>if self._tunnel_host:</pre> <pre class=”line after”><span class=”ws”> </span># If we're tunneling it means we're connected to our proxy.</pre> <pre class=”line after”><span class=”ws”> </span>self._has_connected_to_proxy = True</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># TODO: Fix tunnel so it doesn't depend on self.sock state.</pre></div> </div> <li><div class=”frame” id=”frame-2551837179120″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”</cite>, line <em class=”line”>218</em>, in <code class=”function”>_new_conn</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>self,</pre> <pre class=”line before”><span class=”ws”> </span>f"Connection to {self.host} timed out. (connect timeout={self.timeout})",</pre> <pre class=”line before”><span class=”ws”> </span>) from e</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>except OSError as e:</pre> <pre class=”line current”><span class=”ws”> </span>raise NewConnectionError(</pre> <pre class=”line after”><span class=”ws”> </span>self, f"Failed to establish a new connection: {e}"</pre> <pre class=”line after”><span class=”ws”> </span>) from e</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># Audit hooks are only available in Python 3.8+</pre> <pre class=”line after”><span class=”ws”> </span>if _HAS_SYS_AUDIT:</pre></div> </div> <li><div class=”exc-divider”>The above exception was the direct cause of the following exception:</div> <li><div class=”frame” id=”frame-2551837177776″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py”</cite>, line <em class=”line”>486</em>, in <code class=”function”>send</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>pass</pre> <pre class=”line before”><span class=”ws”> </span>else:</pre> <pre class=”line before”><span class=”ws”> </span>timeout = TimeoutSauce(connect=timeout, read=timeout)</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>resp = conn.urlopen(</pre> <pre class=”line after”><span class=”ws”> </span>method=request.method,</pre> <pre class=”line after”><span class=”ws”> </span>url=url,</pre> <pre class=”line after”><span class=”ws”> </span>body=request.body,</pre> <pre class=”line after”><span class=”ws”> </span>headers=request.headers,</pre> <pre class=”line after”><span class=”ws”> </span>redirect=False,</pre></div> </div> <li><div class=”frame” id=”frame-2551837177888″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”</cite>, line <em class=”line”>844</em>, in <code class=”function”>urlopen</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>) and (conn and conn.proxy and not conn.has_connected_to_proxy):</pre> <pre class=”line before”><span class=”ws”> </span>new_e = _wrap_proxy_error(new_e, conn.proxy.scheme)</pre> <pre class=”line before”><span class=”ws”> </span>elif isinstance(new_e, (OSError, HTTPException)):</pre> <pre class=”line before”><span class=”ws”> </span>new_e = ProtocolError("Connection aborted.", new_e)</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line current”><span class=”ws”> </span>retries = retries.increment(</pre> <pre class=”line after”><span class=”ws”> </span>method, url, error=new_e, _pool=self, _stacktrace=sys.exc_info()[2]</pre> <pre class=”line after”><span class=”ws”> </span>)</pre> <pre class=”line after”><span class=”ws”> </span>retries.sleep()</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># Keep track of the error for the retry warning.</pre></div> </div> <li><div class=”frame” id=”frame-2551837178000″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\util\retry.py”</cite>, line <em class=”line”>515</em>, in <code class=”function”>increment</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>history=history,</pre> <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>if new_retry.is_exhausted():</pre> <pre class=”line before”><span class=”ws”> </span>reason = error or ResponseError(cause)</pre> <pre class=”line current”><span class=”ws”> </span>raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>log.debug("Incremented Retry for (url='%s'): %r", url, new_retry)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>return new_retry</pre> <pre class=”line after”><span class=”ws”></span> </pre></div> </div> <li><div class=”exc-divider”>During handling of the above exception, another exception occurred:</div> <li><div class=”frame” id=”frame-2551837112352″> <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-2551837113472″> <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-2551837113920″> <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-2551837114256″> <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-2551837175872″> <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-2551837175984″> <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-2551837176096″> <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-2551837176208″> <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-2551837176320″> <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-2551837176432″> <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-2551837176544″> <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-2551837176768″> <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-2551837176880″> <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-2551837176992″> <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-2551837177104″> <h4>File <cite class=”filename”>”F:\project\wxgzh\model_server.py”</cite>, line <em class=”line”>355</em>, in <code class=”function”>get_new_content_chatglm</code></h4> <div class=”source “><pre class=”line before”><span class=”ws”> </span>"functions": {},</pre> <pre class=”line before”><span class=”ws”> </span>"repetition_penalty": 1.1</pre> <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 current”><span class=”ws”> </span>response = requests.request("POST", chatglm_url, json=payload, headers=headers)</pre> <pre class=”line after”><span class=”ws”> </span>#print(response)</pre> <pre class=”line after”><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></div> </div> <li><div class=”frame” id=”frame-2551837177216″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\api.py”</cite>, line <em class=”line”>59</em>, in <code class=”function”>request</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># By using the 'with' statement we are sure the session is closed, thus we</pre> <pre class=”line before”><span class=”ws”> </span># avoid leaving sockets open which can trigger a ResourceWarning in some</pre> <pre class=”line before”><span class=”ws”> </span># cases, and look like a memory leak in others.</pre> <pre class=”line before”><span class=”ws”> </span>with sessions.Session() as session:</pre> <pre class=”line current”><span class=”ws”> </span>return session.request(method=method, url=url, **kwargs)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”></span>def get(url, params=None, **kwargs):</pre> <pre class=”line after”><span class=”ws”> </span>r"""Sends a GET request.</pre> <pre class=”line after”><span class=”ws”></span> </pre></div> </div> <li><div class=”frame” id=”frame-2551837177440″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py”</cite>, line <em class=”line”>589</em>, in <code class=”function”>request</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>send_kwargs = {</pre> <pre class=”line before”><span class=”ws”> </span>"timeout": timeout,</pre> <pre class=”line before”><span class=”ws”> </span>"allow_redirects": allow_redirects,</pre> <pre class=”line before”><span class=”ws”> </span>}</pre> <pre class=”line before”><span class=”ws”> </span>send_kwargs.update(settings)</pre> <pre class=”line current”><span class=”ws”> </span>resp = self.send(prep, **send_kwargs)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>return resp</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>def get(self, url, **kwargs):</pre> <pre class=”line after”><span class=”ws”> </span>r"""Sends a GET request. Returns :class:`Response` object.</pre></div> </div> <li><div class=”frame” id=”frame-2551837177552″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py”</cite>, line <em class=”line”>703</em>, in <code class=”function”>send</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># Start time (approximately) of the request</pre> <pre class=”line before”><span class=”ws”> </span>start = preferred_clock()</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># Send the request</pre> <pre class=”line current”><span class=”ws”> </span>r = adapter.send(request, **kwargs)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># Total elapsed time of the request (approximately)</pre> <pre class=”line after”><span class=”ws”> </span>elapsed = preferred_clock() – start</pre> <pre class=”line after”><span class=”ws”> </span>r.elapsed = timedelta(seconds=elapsed)</pre> <pre class=”line after”><span class=”ws”></span> </pre></div> </div> <li><div class=”frame” id=”frame-2551837177664″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py”</cite>, line <em class=”line”>519</em>, in <code class=”function”>send</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>if isinstance(e.reason, _SSLError):</pre> <pre class=”line before”><span class=”ws”> </span># This branch is for urllib3 v1.22 and later.</pre> <pre class=”line before”><span class=”ws”> </span>raise SSLError(e, request=request)</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line current”><span class=”ws”> </span>raise ConnectionError(e, request=request)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>except ClosedPoolError as e:</pre> <pre class=”line after”><span class=”ws”> </span>raise ConnectionError(e, request=request)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>except _ProxyError as e:</pre></div> </div> </ul> <blockquote>requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002522558C340>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) </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\urllib3\connection.py", line 203, in _new_conn sock = connection.create_connection( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py", line 85, in create_connection raise err File "F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py", line 73, in create_connection sock.connect(sa) ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py", line 790, in urlopen response = self._make_request( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py", line 496, in _make_request conn.request( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py", line 395, in request self.endheaders() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1280, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1040, in _send_output self.send(msg) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 980, in send self.connect() File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py", line 243, in connect self.sock = self._new_conn() File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py", line 218, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x000002522558C340>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File "F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py", line 486, in send resp = conn.urlopen( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py", line 844, in urlopen retries = retries.increment( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\util\retry.py", line 515, in increment raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002522558C340>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) 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 355, in get_new_content_chatglm response = requests.request("POST", chatglm_url, json=payload, headers=headers) File "F:\project\wxgzh\venv\lib\site-packages\requests\api.py", line 59, in request return session.request(method=method, url=url, **kwargs) File "F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py", line 589, in request resp = self.send(prep, **send_kwargs) File "F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py", line 703, in send r = adapter.send(request, **kwargs) File "F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py", line 519, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002522558C340>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) </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\urllib3\connection.py”, line 203, in _new_conn sock = connection.create_connection( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py”, line 85, in create_connection raise err File “F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py”, line 73, in create_connection sock.connect(sa) ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”, line 790, in urlopen response = self._make_request( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”, line 496, in _make_request conn.request( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”, line 395, in request self.endheaders() File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”, line 1280, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”, line 1040, in _send_output self.send(msg) File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”, line 980, in send self.connect() File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”, line 243, in connect self.sock = self._new_conn() File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”, line 218, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x000002522558C340>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File “F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py”, line 486, in send resp = conn.urlopen( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”, line 844, in urlopen retries = retries.increment( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\util\retry.py”, line 515, in increment raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host=’127.0.0.1′, port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0x000002522558C340>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。’)) 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 355, in get_new_content_chatglm response = requests.request(“POST”, chatglm_url, json=payload, headers=headers) File “F:\project\wxgzh\venv\lib\site-packages\requests\api.py”, line 59, in request return session.request(method=method, url=url, **kwargs) File “F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py”, line 589, in request resp = self.send(prep, **send_kwargs) File “F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py”, line 703, in send r = adapter.send(request, **kwargs) File “F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py”, line 519, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host=’127.0.0.1′, port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0x000002522558C340>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。’)) –>
发布内测邀请后次日删除由一家小公司运营<!doctype html> <html lang=en> <head> <title>requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002522657D1F0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) // 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>ConnectionError</h1> <div class=”detail”> <p class=”errormsg”>requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002522657D1F0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) </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-2551853842320″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”</cite>, line <em class=”line”>203</em>, in <code class=”function”>_new_conn</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>"""Establish a socket connection and set nodelay settings on it.</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>:return: New socket connection.</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>sock = connection.create_connection(</pre> <pre class=”line after”><span class=”ws”> </span>(self._dns_host, self.port),</pre> <pre class=”line after”><span class=”ws”> </span>self.timeout,</pre> <pre class=”line after”><span class=”ws”> </span>source_address=self.source_address,</pre> <pre class=”line after”><span class=”ws”> </span>socket_options=self.socket_options,</pre> <pre class=”line after”><span class=”ws”> </span>)</pre></div> </div> <li><div class=”frame” id=”frame-2551853903936″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py”</cite>, line <em class=”line”>85</em>, in <code class=”function”>create_connection</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>if sock is not None:</pre> <pre class=”line before”><span class=”ws”> </span>sock.close()</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>if err is not None:</pre> <pre class=”line before”><span class=”ws”> </span>try:</pre> <pre class=”line current”><span class=”ws”> </span>raise err</pre> <pre class=”line after”><span class=”ws”> </span>finally:</pre> <pre class=”line after”><span class=”ws”> </span># Break explicitly a reference cycle</pre> <pre class=”line after”><span class=”ws”> </span>err = None</pre> <pre class=”line after”><span class=”ws”> </span>else:</pre> <pre class=”line after”><span class=”ws”> </span>raise OSError("getaddrinfo returns an empty list")</pre></div> </div> <li><div class=”frame” id=”frame-2551853904048″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py”</cite>, line <em class=”line”>73</em>, in <code class=”function”>create_connection</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>if timeout is not _DEFAULT_TIMEOUT:</pre> <pre class=”line before”><span class=”ws”> </span>sock.settimeout(timeout)</pre> <pre class=”line before”><span class=”ws”> </span>if source_address:</pre> <pre class=”line before”><span class=”ws”> </span>sock.bind(source_address)</pre> <pre class=”line current”><span class=”ws”> </span>sock.connect(sa)</pre> <pre class=”line after”><span class=”ws”> </span># Break explicitly a reference cycle</pre> <pre class=”line after”><span class=”ws”> </span>err = None</pre> <pre class=”line after”><span class=”ws”> </span>return sock</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>except OSError as _:</pre></div> </div> <li><div class=”exc-divider”>The above exception was the direct cause of the following exception:</div> <li><div class=”frame” id=”frame-2551853841200″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”</cite>, line <em class=”line”>790</em>, in <code class=”function”>urlopen</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span># it will also try to release it and we'll have a double-release</pre> <pre class=”line before”><span class=”ws”> </span># mess.</pre> <pre class=”line before”><span class=”ws”> </span>response_conn = conn if not release_conn else None</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># Make the request on the HTTPConnection object</pre> <pre class=”line current”><span class=”ws”> </span>response = self._make_request(</pre> <pre class=”line after”><span class=”ws”> </span>conn,</pre> <pre class=”line after”><span class=”ws”> </span>method,</pre> <pre class=”line after”><span class=”ws”> </span>url,</pre> <pre class=”line after”><span class=”ws”> </span>timeout=timeout_obj,</pre> <pre class=”line after”><span class=”ws”> </span>body=body,</pre></div> </div> <li><div class=”frame” id=”frame-2551853841312″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”</cite>, line <em class=”line”>496</em>, in <code class=”function”>_make_request</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>raise new_e</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># conn.request() calls http.client.*.request, not the method in</pre> <pre class=”line before”><span class=”ws”> </span># urllib3.request. It also calls makefile (recv) on the socket.</pre> <pre class=”line before”><span class=”ws”> </span>try:</pre> <pre class=”line current”><span class=”ws”> </span>conn.request(</pre> <pre class=”line after”><span class=”ws”> </span>method,</pre> <pre class=”line after”><span class=”ws”> </span>url,</pre> <pre class=”line after”><span class=”ws”> </span>body=body,</pre> <pre class=”line after”><span class=”ws”> </span>headers=headers,</pre> <pre class=”line after”><span class=”ws”> </span>chunked=chunked,</pre></div> </div> <li><div class=”frame” id=”frame-2551853841424″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”</cite>, line <em class=”line”>395</em>, in <code class=”function”>request</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span># Now that framing headers are out of the way we send all the other headers.</pre> <pre class=”line before”><span class=”ws”> </span>if "user-agent" not in header_keys:</pre> <pre class=”line before”><span class=”ws”> </span>self.putheader("User-Agent", _get_default_user_agent())</pre> <pre class=”line before”><span class=”ws”> </span>for header, value in headers.items():</pre> <pre class=”line before”><span class=”ws”> </span>self.putheader(header, value)</pre> <pre class=”line current”><span class=”ws”> </span>self.endheaders()</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># If we're given a body we start sending that in chunks.</pre> <pre class=”line after”><span class=”ws”> </span>if chunks is not None:</pre> <pre class=”line after”><span class=”ws”> </span>for chunk in chunks:</pre> <pre class=”line after”><span class=”ws”> </span># Sending empty chunks isn't allowed for TE: chunked</pre></div> </div> <li><div class=”frame” id=”frame-2551853841536″> <h4>File <cite class=”filename”>”C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”</cite>, line <em class=”line”>1280</em>, in <code class=”function”>endheaders</code></h4> <div class=”source “><pre class=”line before”><span class=”ws”> </span>"""</pre> <pre class=”line before”><span class=”ws”> </span>if self.__state == _CS_REQ_STARTED:</pre> <pre class=”line before”><span class=”ws”> </span>self.__state = _CS_REQ_SENT</pre> <pre class=”line before”><span class=”ws”> </span>else:</pre> <pre class=”line before”><span class=”ws”> </span>raise CannotSendHeader()</pre> <pre class=”line current”><span class=”ws”> </span>self._send_output(message_body, encode_chunked=encode_chunked)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>def request(self, method, url, body=None, headers={}, *,</pre> <pre class=”line after”><span class=”ws”> </span>encode_chunked=False):</pre> <pre class=”line after”><span class=”ws”> </span>"""Send a complete request to the server."""</pre> <pre class=”line after”><span class=”ws”> </span>self._send_request(method, url, body, headers, encode_chunked)</pre></div> </div> <li><div class=”frame” id=”frame-2551853841760″> <h4>File <cite class=”filename”>”C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”</cite>, line <em class=”line”>1040</em>, in <code class=”function”>_send_output</code></h4> <div class=”source “><pre class=”line before”><span class=”ws”> </span>A message_body may be specified, to be appended to the request.</pre> <pre class=”line before”><span class=”ws”> </span>"""</pre> <pre class=”line before”><span class=”ws”> </span>self._buffer.extend((b"", b""))</pre> <pre class=”line before”><span class=”ws”> </span>msg = b"\r\n".join(self._buffer)</pre> <pre class=”line before”><span class=”ws”> </span>del self._buffer[:]</pre> <pre class=”line current”><span class=”ws”> </span>self.send(msg)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>if message_body is not None:</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># create a consistent interface to message_body</pre> <pre class=”line after”><span class=”ws”> </span>if hasattr(message_body, 'read'):</pre></div> </div> <li><div class=”frame” id=”frame-2551853841872″> <h4>File <cite class=”filename”>”C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”</cite>, line <em class=”line”>980</em>, in <code class=”function”>send</code></h4> <div class=”source “><pre class=”line before”><span class=”ws”> </span>file-like object that supports a .read() method, or an iterable object.</pre> <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>if self.sock is None:</pre> <pre class=”line before”><span class=”ws”> </span>if self.auto_open:</pre> <pre class=”line current”><span class=”ws”> </span>self.connect()</pre> <pre class=”line after”><span class=”ws”> </span>else:</pre> <pre class=”line after”><span class=”ws”> </span>raise NotConnected()</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>if self.debuglevel > 0:</pre> <pre class=”line after”><span class=”ws”> </span>print("send:", repr(data))</pre></div> </div> <li><div class=”frame” id=”frame-2551853841984″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”</cite>, line <em class=”line”>243</em>, in <code class=”function”>connect</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>)</pre> <pre class=”line before”><span class=”ws”> </span>super().set_tunnel(host, port=port, headers=headers)</pre> <pre class=”line before”><span class=”ws”> </span>self._tunnel_scheme = scheme</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>def connect(self) -> None:</pre> <pre class=”line current”><span class=”ws”> </span>self.sock = self._new_conn()</pre> <pre class=”line after”><span class=”ws”> </span>if self._tunnel_host:</pre> <pre class=”line after”><span class=”ws”> </span># If we're tunneling it means we're connected to our proxy.</pre> <pre class=”line after”><span class=”ws”> </span>self._has_connected_to_proxy = True</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># TODO: Fix tunnel so it doesn't depend on self.sock state.</pre></div> </div> <li><div class=”frame” id=”frame-2551853842096″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”</cite>, line <em class=”line”>218</em>, in <code class=”function”>_new_conn</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>self,</pre> <pre class=”line before”><span class=”ws”> </span>f"Connection to {self.host} timed out. (connect timeout={self.timeout})",</pre> <pre class=”line before”><span class=”ws”> </span>) from e</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>except OSError as e:</pre> <pre class=”line current”><span class=”ws”> </span>raise NewConnectionError(</pre> <pre class=”line after”><span class=”ws”> </span>self, f"Failed to establish a new connection: {e}"</pre> <pre class=”line after”><span class=”ws”> </span>) from e</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># Audit hooks are only available in Python 3.8+</pre> <pre class=”line after”><span class=”ws”> </span>if _HAS_SYS_AUDIT:</pre></div> </div> <li><div class=”exc-divider”>The above exception was the direct cause of the following exception:</div> <li><div class=”frame” id=”frame-2551853840752″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py”</cite>, line <em class=”line”>486</em>, in <code class=”function”>send</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>pass</pre> <pre class=”line before”><span class=”ws”> </span>else:</pre> <pre class=”line before”><span class=”ws”> </span>timeout = TimeoutSauce(connect=timeout, read=timeout)</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>resp = conn.urlopen(</pre> <pre class=”line after”><span class=”ws”> </span>method=request.method,</pre> <pre class=”line after”><span class=”ws”> </span>url=url,</pre> <pre class=”line after”><span class=”ws”> </span>body=request.body,</pre> <pre class=”line after”><span class=”ws”> </span>headers=request.headers,</pre> <pre class=”line after”><span class=”ws”> </span>redirect=False,</pre></div> </div> <li><div class=”frame” id=”frame-2551853840864″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”</cite>, line <em class=”line”>844</em>, in <code class=”function”>urlopen</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>) and (conn and conn.proxy and not conn.has_connected_to_proxy):</pre> <pre class=”line before”><span class=”ws”> </span>new_e = _wrap_proxy_error(new_e, conn.proxy.scheme)</pre> <pre class=”line before”><span class=”ws”> </span>elif isinstance(new_e, (OSError, HTTPException)):</pre> <pre class=”line before”><span class=”ws”> </span>new_e = ProtocolError("Connection aborted.", new_e)</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line current”><span class=”ws”> </span>retries = retries.increment(</pre> <pre class=”line after”><span class=”ws”> </span>method, url, error=new_e, _pool=self, _stacktrace=sys.exc_info()[2]</pre> <pre class=”line after”><span class=”ws”> </span>)</pre> <pre class=”line after”><span class=”ws”> </span>retries.sleep()</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># Keep track of the error for the retry warning.</pre></div> </div> <li><div class=”frame” id=”frame-2551853840976″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\util\retry.py”</cite>, line <em class=”line”>515</em>, in <code class=”function”>increment</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>history=history,</pre> <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>if new_retry.is_exhausted():</pre> <pre class=”line before”><span class=”ws”> </span>reason = error or ResponseError(cause)</pre> <pre class=”line current”><span class=”ws”> </span>raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>log.debug("Incremented Retry for (url='%s'): %r", url, new_retry)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>return new_retry</pre> <pre class=”line after”><span class=”ws”></span> </pre></div> </div> <li><div class=”exc-divider”>During handling of the above exception, another exception occurred:</div> <li><div class=”frame” id=”frame-2551837224736″> <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-2551837223616″> <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-2551853838624″> <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-2551853838736″> <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-2551853838848″> <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-2551853838960″> <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-2551853839072″> <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-2551853839184″> <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-2551853839296″> <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-2551853839408″> <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-2551853839520″> <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-2551853839744″> <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-2551853839856″> <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-2551853839968″> <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-2551853840080″> <h4>File <cite class=”filename”>”F:\project\wxgzh\model_server.py”</cite>, line <em class=”line”>355</em>, in <code class=”function”>get_new_content_chatglm</code></h4> <div class=”source “><pre class=”line before”><span class=”ws”> </span>"functions": {},</pre> <pre class=”line before”><span class=”ws”> </span>"repetition_penalty": 1.1</pre> <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 current”><span class=”ws”> </span>response = requests.request("POST", chatglm_url, json=payload, headers=headers)</pre> <pre class=”line after”><span class=”ws”> </span>#print(response)</pre> <pre class=”line after”><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></div> </div> <li><div class=”frame” id=”frame-2551853840192″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\api.py”</cite>, line <em class=”line”>59</em>, in <code class=”function”>request</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># By using the 'with' statement we are sure the session is closed, thus we</pre> <pre class=”line before”><span class=”ws”> </span># avoid leaving sockets open which can trigger a ResourceWarning in some</pre> <pre class=”line before”><span class=”ws”> </span># cases, and look like a memory leak in others.</pre> <pre class=”line before”><span class=”ws”> </span>with sessions.Session() as session:</pre> <pre class=”line current”><span class=”ws”> </span>return session.request(method=method, url=url, **kwargs)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”></span>def get(url, params=None, **kwargs):</pre> <pre class=”line after”><span class=”ws”> </span>r"""Sends a GET request.</pre> <pre class=”line after”><span class=”ws”></span> </pre></div> </div> <li><div class=”frame” id=”frame-2551853840416″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py”</cite>, line <em class=”line”>589</em>, in <code class=”function”>request</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>send_kwargs = {</pre> <pre class=”line before”><span class=”ws”> </span>"timeout": timeout,</pre> <pre class=”line before”><span class=”ws”> </span>"allow_redirects": allow_redirects,</pre> <pre class=”line before”><span class=”ws”> </span>}</pre> <pre class=”line before”><span class=”ws”> </span>send_kwargs.update(settings)</pre> <pre class=”line current”><span class=”ws”> </span>resp = self.send(prep, **send_kwargs)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>return resp</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>def get(self, url, **kwargs):</pre> <pre class=”line after”><span class=”ws”> </span>r"""Sends a GET request. Returns :class:`Response` object.</pre></div> </div> <li><div class=”frame” id=”frame-2551853840528″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py”</cite>, line <em class=”line”>703</em>, in <code class=”function”>send</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># Start time (approximately) of the request</pre> <pre class=”line before”><span class=”ws”> </span>start = preferred_clock()</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># Send the request</pre> <pre class=”line current”><span class=”ws”> </span>r = adapter.send(request, **kwargs)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># Total elapsed time of the request (approximately)</pre> <pre class=”line after”><span class=”ws”> </span>elapsed = preferred_clock() – start</pre> <pre class=”line after”><span class=”ws”> </span>r.elapsed = timedelta(seconds=elapsed)</pre> <pre class=”line after”><span class=”ws”></span> </pre></div> </div> <li><div class=”frame” id=”frame-2551853840640″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py”</cite>, line <em class=”line”>519</em>, in <code class=”function”>send</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>if isinstance(e.reason, _SSLError):</pre> <pre class=”line before”><span class=”ws”> </span># This branch is for urllib3 v1.22 and later.</pre> <pre class=”line before”><span class=”ws”> </span>raise SSLError(e, request=request)</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line current”><span class=”ws”> </span>raise ConnectionError(e, request=request)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>except ClosedPoolError as e:</pre> <pre class=”line after”><span class=”ws”> </span>raise ConnectionError(e, request=request)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>except _ProxyError as e:</pre></div> </div> </ul> <blockquote>requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002522657D1F0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) </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\urllib3\connection.py", line 203, in _new_conn sock = connection.create_connection( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py", line 85, in create_connection raise err File "F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py", line 73, in create_connection sock.connect(sa) ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py", line 790, in urlopen response = self._make_request( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py", line 496, in _make_request conn.request( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py", line 395, in request self.endheaders() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1280, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1040, in _send_output self.send(msg) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 980, in send self.connect() File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py", line 243, in connect self.sock = self._new_conn() File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py", line 218, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x000002522657D1F0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File "F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py", line 486, in send resp = conn.urlopen( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py", line 844, in urlopen retries = retries.increment( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\util\retry.py", line 515, in increment raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002522657D1F0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) 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 355, in get_new_content_chatglm response = requests.request("POST", chatglm_url, json=payload, headers=headers) File "F:\project\wxgzh\venv\lib\site-packages\requests\api.py", line 59, in request return session.request(method=method, url=url, **kwargs) File "F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py", line 589, in request resp = self.send(prep, **send_kwargs) File "F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py", line 703, in send r = adapter.send(request, **kwargs) File "F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py", line 519, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002522657D1F0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) </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\urllib3\connection.py”, line 203, in _new_conn sock = connection.create_connection( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py”, line 85, in create_connection raise err File “F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py”, line 73, in create_connection sock.connect(sa) ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”, line 790, in urlopen response = self._make_request( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”, line 496, in _make_request conn.request( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”, line 395, in request self.endheaders() File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”, line 1280, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”, line 1040, in _send_output self.send(msg) File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”, line 980, in send self.connect() File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”, line 243, in connect self.sock = self._new_conn() File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”, line 218, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x000002522657D1F0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File “F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py”, line 486, in send resp = conn.urlopen( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”, line 844, in urlopen retries = retries.increment( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\util\retry.py”, line 515, in increment raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host=’127.0.0.1′, port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0x000002522657D1F0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。’)) 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 355, in get_new_content_chatglm response = requests.request(“POST”, chatglm_url, json=payload, headers=headers) File “F:\project\wxgzh\venv\lib\site-packages\requests\api.py”, line 59, in request return session.request(method=method, url=url, **kwargs) File “F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py”, line 589, in request resp = self.send(prep, **send_kwargs) File “F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py”, line 703, in send r = adapter.send(request, **kwargs) File “F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py”, line 519, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host=’127.0.0.1′, port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0x000002522657D1F0>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。’)) –>
<!doctype html> <html lang=en> <head> <title>requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000025226599490>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) // 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>ConnectionError</h1> <div class=”detail”> <p class=”errormsg”>requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000025226599490>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) </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-2551854023056″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”</cite>, line <em class=”line”>203</em>, in <code class=”function”>_new_conn</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>"""Establish a socket connection and set nodelay settings on it.</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>:return: New socket connection.</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>sock = connection.create_connection(</pre> <pre class=”line after”><span class=”ws”> </span>(self._dns_host, self.port),</pre> <pre class=”line after”><span class=”ws”> </span>self.timeout,</pre> <pre class=”line after”><span class=”ws”> </span>source_address=self.source_address,</pre> <pre class=”line after”><span class=”ws”> </span>socket_options=self.socket_options,</pre> <pre class=”line after”><span class=”ws”> </span>)</pre></div> </div> <li><div class=”frame” id=”frame-2551854023168″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py”</cite>, line <em class=”line”>85</em>, in <code class=”function”>create_connection</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>if sock is not None:</pre> <pre class=”line before”><span class=”ws”> </span>sock.close()</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>if err is not None:</pre> <pre class=”line before”><span class=”ws”> </span>try:</pre> <pre class=”line current”><span class=”ws”> </span>raise err</pre> <pre class=”line after”><span class=”ws”> </span>finally:</pre> <pre class=”line after”><span class=”ws”> </span># Break explicitly a reference cycle</pre> <pre class=”line after”><span class=”ws”> </span>err = None</pre> <pre class=”line after”><span class=”ws”> </span>else:</pre> <pre class=”line after”><span class=”ws”> </span>raise OSError("getaddrinfo returns an empty list")</pre></div> </div> <li><div class=”frame” id=”frame-2551854023280″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py”</cite>, line <em class=”line”>73</em>, in <code class=”function”>create_connection</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>if timeout is not _DEFAULT_TIMEOUT:</pre> <pre class=”line before”><span class=”ws”> </span>sock.settimeout(timeout)</pre> <pre class=”line before”><span class=”ws”> </span>if source_address:</pre> <pre class=”line before”><span class=”ws”> </span>sock.bind(source_address)</pre> <pre class=”line current”><span class=”ws”> </span>sock.connect(sa)</pre> <pre class=”line after”><span class=”ws”> </span># Break explicitly a reference cycle</pre> <pre class=”line after”><span class=”ws”> </span>err = None</pre> <pre class=”line after”><span class=”ws”> </span>return sock</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>except OSError as _:</pre></div> </div> <li><div class=”exc-divider”>The above exception was the direct cause of the following exception:</div> <li><div class=”frame” id=”frame-2551853968624″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”</cite>, line <em class=”line”>790</em>, in <code class=”function”>urlopen</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span># it will also try to release it and we'll have a double-release</pre> <pre class=”line before”><span class=”ws”> </span># mess.</pre> <pre class=”line before”><span class=”ws”> </span>response_conn = conn if not release_conn else None</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># Make the request on the HTTPConnection object</pre> <pre class=”line current”><span class=”ws”> </span>response = self._make_request(</pre> <pre class=”line after”><span class=”ws”> </span>conn,</pre> <pre class=”line after”><span class=”ws”> </span>method,</pre> <pre class=”line after”><span class=”ws”> </span>url,</pre> <pre class=”line after”><span class=”ws”> </span>timeout=timeout_obj,</pre> <pre class=”line after”><span class=”ws”> </span>body=body,</pre></div> </div> <li><div class=”frame” id=”frame-2551853968736″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”</cite>, line <em class=”line”>496</em>, in <code class=”function”>_make_request</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>raise new_e</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># conn.request() calls http.client.*.request, not the method in</pre> <pre class=”line before”><span class=”ws”> </span># urllib3.request. It also calls makefile (recv) on the socket.</pre> <pre class=”line before”><span class=”ws”> </span>try:</pre> <pre class=”line current”><span class=”ws”> </span>conn.request(</pre> <pre class=”line after”><span class=”ws”> </span>method,</pre> <pre class=”line after”><span class=”ws”> </span>url,</pre> <pre class=”line after”><span class=”ws”> </span>body=body,</pre> <pre class=”line after”><span class=”ws”> </span>headers=headers,</pre> <pre class=”line after”><span class=”ws”> </span>chunked=chunked,</pre></div> </div> <li><div class=”frame” id=”frame-2551853968848″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”</cite>, line <em class=”line”>395</em>, in <code class=”function”>request</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span># Now that framing headers are out of the way we send all the other headers.</pre> <pre class=”line before”><span class=”ws”> </span>if "user-agent" not in header_keys:</pre> <pre class=”line before”><span class=”ws”> </span>self.putheader("User-Agent", _get_default_user_agent())</pre> <pre class=”line before”><span class=”ws”> </span>for header, value in headers.items():</pre> <pre class=”line before”><span class=”ws”> </span>self.putheader(header, value)</pre> <pre class=”line current”><span class=”ws”> </span>self.endheaders()</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># If we're given a body we start sending that in chunks.</pre> <pre class=”line after”><span class=”ws”> </span>if chunks is not None:</pre> <pre class=”line after”><span class=”ws”> </span>for chunk in chunks:</pre> <pre class=”line after”><span class=”ws”> </span># Sending empty chunks isn't allowed for TE: chunked</pre></div> </div> <li><div class=”frame” id=”frame-2551853968960″> <h4>File <cite class=”filename”>”C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”</cite>, line <em class=”line”>1280</em>, in <code class=”function”>endheaders</code></h4> <div class=”source “><pre class=”line before”><span class=”ws”> </span>"""</pre> <pre class=”line before”><span class=”ws”> </span>if self.__state == _CS_REQ_STARTED:</pre> <pre class=”line before”><span class=”ws”> </span>self.__state = _CS_REQ_SENT</pre> <pre class=”line before”><span class=”ws”> </span>else:</pre> <pre class=”line before”><span class=”ws”> </span>raise CannotSendHeader()</pre> <pre class=”line current”><span class=”ws”> </span>self._send_output(message_body, encode_chunked=encode_chunked)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>def request(self, method, url, body=None, headers={}, *,</pre> <pre class=”line after”><span class=”ws”> </span>encode_chunked=False):</pre> <pre class=”line after”><span class=”ws”> </span>"""Send a complete request to the server."""</pre> <pre class=”line after”><span class=”ws”> </span>self._send_request(method, url, body, headers, encode_chunked)</pre></div> </div> <li><div class=”frame” id=”frame-2551853969184″> <h4>File <cite class=”filename”>”C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”</cite>, line <em class=”line”>1040</em>, in <code class=”function”>_send_output</code></h4> <div class=”source “><pre class=”line before”><span class=”ws”> </span>A message_body may be specified, to be appended to the request.</pre> <pre class=”line before”><span class=”ws”> </span>"""</pre> <pre class=”line before”><span class=”ws”> </span>self._buffer.extend((b"", b""))</pre> <pre class=”line before”><span class=”ws”> </span>msg = b"\r\n".join(self._buffer)</pre> <pre class=”line before”><span class=”ws”> </span>del self._buffer[:]</pre> <pre class=”line current”><span class=”ws”> </span>self.send(msg)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>if message_body is not None:</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># create a consistent interface to message_body</pre> <pre class=”line after”><span class=”ws”> </span>if hasattr(message_body, 'read'):</pre></div> </div> <li><div class=”frame” id=”frame-2551853969296″> <h4>File <cite class=”filename”>”C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”</cite>, line <em class=”line”>980</em>, in <code class=”function”>send</code></h4> <div class=”source “><pre class=”line before”><span class=”ws”> </span>file-like object that supports a .read() method, or an iterable object.</pre> <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>if self.sock is None:</pre> <pre class=”line before”><span class=”ws”> </span>if self.auto_open:</pre> <pre class=”line current”><span class=”ws”> </span>self.connect()</pre> <pre class=”line after”><span class=”ws”> </span>else:</pre> <pre class=”line after”><span class=”ws”> </span>raise NotConnected()</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>if self.debuglevel > 0:</pre> <pre class=”line after”><span class=”ws”> </span>print("send:", repr(data))</pre></div> </div> <li><div class=”frame” id=”frame-2551854022720″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”</cite>, line <em class=”line”>243</em>, in <code class=”function”>connect</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>)</pre> <pre class=”line before”><span class=”ws”> </span>super().set_tunnel(host, port=port, headers=headers)</pre> <pre class=”line before”><span class=”ws”> </span>self._tunnel_scheme = scheme</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>def connect(self) -> None:</pre> <pre class=”line current”><span class=”ws”> </span>self.sock = self._new_conn()</pre> <pre class=”line after”><span class=”ws”> </span>if self._tunnel_host:</pre> <pre class=”line after”><span class=”ws”> </span># If we're tunneling it means we're connected to our proxy.</pre> <pre class=”line after”><span class=”ws”> </span>self._has_connected_to_proxy = True</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># TODO: Fix tunnel so it doesn't depend on self.sock state.</pre></div> </div> <li><div class=”frame” id=”frame-2551854022832″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”</cite>, line <em class=”line”>218</em>, in <code class=”function”>_new_conn</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>self,</pre> <pre class=”line before”><span class=”ws”> </span>f"Connection to {self.host} timed out. (connect timeout={self.timeout})",</pre> <pre class=”line before”><span class=”ws”> </span>) from e</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>except OSError as e:</pre> <pre class=”line current”><span class=”ws”> </span>raise NewConnectionError(</pre> <pre class=”line after”><span class=”ws”> </span>self, f"Failed to establish a new connection: {e}"</pre> <pre class=”line after”><span class=”ws”> </span>) from e</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># Audit hooks are only available in Python 3.8+</pre> <pre class=”line after”><span class=”ws”> </span>if _HAS_SYS_AUDIT:</pre></div> </div> <li><div class=”exc-divider”>The above exception was the direct cause of the following exception:</div> <li><div class=”frame” id=”frame-2551853968176″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py”</cite>, line <em class=”line”>486</em>, in <code class=”function”>send</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>pass</pre> <pre class=”line before”><span class=”ws”> </span>else:</pre> <pre class=”line before”><span class=”ws”> </span>timeout = TimeoutSauce(connect=timeout, read=timeout)</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>resp = conn.urlopen(</pre> <pre class=”line after”><span class=”ws”> </span>method=request.method,</pre> <pre class=”line after”><span class=”ws”> </span>url=url,</pre> <pre class=”line after”><span class=”ws”> </span>body=request.body,</pre> <pre class=”line after”><span class=”ws”> </span>headers=request.headers,</pre> <pre class=”line after”><span class=”ws”> </span>redirect=False,</pre></div> </div> <li><div class=”frame” id=”frame-2551853968288″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”</cite>, line <em class=”line”>844</em>, in <code class=”function”>urlopen</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>) and (conn and conn.proxy and not conn.has_connected_to_proxy):</pre> <pre class=”line before”><span class=”ws”> </span>new_e = _wrap_proxy_error(new_e, conn.proxy.scheme)</pre> <pre class=”line before”><span class=”ws”> </span>elif isinstance(new_e, (OSError, HTTPException)):</pre> <pre class=”line before”><span class=”ws”> </span>new_e = ProtocolError("Connection aborted.", new_e)</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line current”><span class=”ws”> </span>retries = retries.increment(</pre> <pre class=”line after”><span class=”ws”> </span>method, url, error=new_e, _pool=self, _stacktrace=sys.exc_info()[2]</pre> <pre class=”line after”><span class=”ws”> </span>)</pre> <pre class=”line after”><span class=”ws”> </span>retries.sleep()</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># Keep track of the error for the retry warning.</pre></div> </div> <li><div class=”frame” id=”frame-2551853968400″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\util\retry.py”</cite>, line <em class=”line”>515</em>, in <code class=”function”>increment</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>history=history,</pre> <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>if new_retry.is_exhausted():</pre> <pre class=”line before”><span class=”ws”> </span>reason = error or ResponseError(cause)</pre> <pre class=”line current”><span class=”ws”> </span>raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>log.debug("Incremented Retry for (url='%s'): %r", url, new_retry)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>return new_retry</pre> <pre class=”line after”><span class=”ws”></span> </pre></div> </div> <li><div class=”exc-divider”>During handling of the above exception, another exception occurred:</div> <li><div class=”frame” id=”frame-2551853965936″> <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-2551853965376″> <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-2551853965824″> <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-2551853966160″> <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-2551853966272″> <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-2551853966384″> <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-2551853966496″> <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-2551853966608″> <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-2551853966720″> <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-2551853966832″> <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-2551853966944″> <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-2551853967168″> <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-2551853967280″> <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-2551853967392″> <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-2551853967504″> <h4>File <cite class=”filename”>”F:\project\wxgzh\model_server.py”</cite>, line <em class=”line”>355</em>, in <code class=”function”>get_new_content_chatglm</code></h4> <div class=”source “><pre class=”line before”><span class=”ws”> </span>"functions": {},</pre> <pre class=”line before”><span class=”ws”> </span>"repetition_penalty": 1.1</pre> <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 current”><span class=”ws”> </span>response = requests.request("POST", chatglm_url, json=payload, headers=headers)</pre> <pre class=”line after”><span class=”ws”> </span>#print(response)</pre> <pre class=”line after”><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></div> </div> <li><div class=”frame” id=”frame-2551853967616″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\api.py”</cite>, line <em class=”line”>59</em>, in <code class=”function”>request</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># By using the 'with' statement we are sure the session is closed, thus we</pre> <pre class=”line before”><span class=”ws”> </span># avoid leaving sockets open which can trigger a ResourceWarning in some</pre> <pre class=”line before”><span class=”ws”> </span># cases, and look like a memory leak in others.</pre> <pre class=”line before”><span class=”ws”> </span>with sessions.Session() as session:</pre> <pre class=”line current”><span class=”ws”> </span>return session.request(method=method, url=url, **kwargs)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”></span>def get(url, params=None, **kwargs):</pre> <pre class=”line after”><span class=”ws”> </span>r"""Sends a GET request.</pre> <pre class=”line after”><span class=”ws”></span> </pre></div> </div> <li><div class=”frame” id=”frame-2551853967840″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py”</cite>, line <em class=”line”>589</em>, in <code class=”function”>request</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>send_kwargs = {</pre> <pre class=”line before”><span class=”ws”> </span>"timeout": timeout,</pre> <pre class=”line before”><span class=”ws”> </span>"allow_redirects": allow_redirects,</pre> <pre class=”line before”><span class=”ws”> </span>}</pre> <pre class=”line before”><span class=”ws”> </span>send_kwargs.update(settings)</pre> <pre class=”line current”><span class=”ws”> </span>resp = self.send(prep, **send_kwargs)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>return resp</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>def get(self, url, **kwargs):</pre> <pre class=”line after”><span class=”ws”> </span>r"""Sends a GET request. Returns :class:`Response` object.</pre></div> </div> <li><div class=”frame” id=”frame-2551853967952″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py”</cite>, line <em class=”line”>703</em>, in <code class=”function”>send</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># Start time (approximately) of the request</pre> <pre class=”line before”><span class=”ws”> </span>start = preferred_clock()</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># Send the request</pre> <pre class=”line current”><span class=”ws”> </span>r = adapter.send(request, **kwargs)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># Total elapsed time of the request (approximately)</pre> <pre class=”line after”><span class=”ws”> </span>elapsed = preferred_clock() – start</pre> <pre class=”line after”><span class=”ws”> </span>r.elapsed = timedelta(seconds=elapsed)</pre> <pre class=”line after”><span class=”ws”></span> </pre></div> </div> <li><div class=”frame” id=”frame-2551853968064″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py”</cite>, line <em class=”line”>519</em>, in <code class=”function”>send</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>if isinstance(e.reason, _SSLError):</pre> <pre class=”line before”><span class=”ws”> </span># This branch is for urllib3 v1.22 and later.</pre> <pre class=”line before”><span class=”ws”> </span>raise SSLError(e, request=request)</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line current”><span class=”ws”> </span>raise ConnectionError(e, request=request)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>except ClosedPoolError as e:</pre> <pre class=”line after”><span class=”ws”> </span>raise ConnectionError(e, request=request)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>except _ProxyError as e:</pre></div> </div> </ul> <blockquote>requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000025226599490>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) </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\urllib3\connection.py", line 203, in _new_conn sock = connection.create_connection( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py", line 85, in create_connection raise err File "F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py", line 73, in create_connection sock.connect(sa) ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py", line 790, in urlopen response = self._make_request( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py", line 496, in _make_request conn.request( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py", line 395, in request self.endheaders() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1280, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1040, in _send_output self.send(msg) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 980, in send self.connect() File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py", line 243, in connect self.sock = self._new_conn() File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py", line 218, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x0000025226599490>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File "F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py", line 486, in send resp = conn.urlopen( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py", line 844, in urlopen retries = retries.increment( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\util\retry.py", line 515, in increment raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000025226599490>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) 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 355, in get_new_content_chatglm response = requests.request("POST", chatglm_url, json=payload, headers=headers) File "F:\project\wxgzh\venv\lib\site-packages\requests\api.py", line 59, in request return session.request(method=method, url=url, **kwargs) File "F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py", line 589, in request resp = self.send(prep, **send_kwargs) File "F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py", line 703, in send r = adapter.send(request, **kwargs) File "F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py", line 519, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000025226599490>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) </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\urllib3\connection.py”, line 203, in _new_conn sock = connection.create_connection( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py”, line 85, in create_connection raise err File “F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py”, line 73, in create_connection sock.connect(sa) ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”, line 790, in urlopen response = self._make_request( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”, line 496, in _make_request conn.request( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”, line 395, in request self.endheaders() File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”, line 1280, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”, line 1040, in _send_output self.send(msg) File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”, line 980, in send self.connect() File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”, line 243, in connect self.sock = self._new_conn() File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”, line 218, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x0000025226599490>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File “F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py”, line 486, in send resp = conn.urlopen( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”, line 844, in urlopen retries = retries.increment( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\util\retry.py”, line 515, in increment raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host=’127.0.0.1′, port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0x0000025226599490>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。’)) 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 355, in get_new_content_chatglm response = requests.request(“POST”, chatglm_url, json=payload, headers=headers) File “F:\project\wxgzh\venv\lib\site-packages\requests\api.py”, line 59, in request return session.request(method=method, url=url, **kwargs) File “F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py”, line 589, in request resp = self.send(prep, **send_kwargs) File “F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py”, line 703, in send r = adapter.send(request, **kwargs) File “F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py”, line 519, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host=’127.0.0.1′, port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0x0000025226599490>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。’)) –>
文章还特别强调,“MJCN只有这一个频道”。
但奇怪的是,5月16日,该公众号就删除了内测邀请的推送文章。
目前,该公众号什么内容都没有,空空如也。
<!doctype html> <html lang=en> <head> <title>requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000252265B7820>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) // 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>ConnectionError</h1> <div class=”detail”> <p class=”errormsg”>requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000252265B7820>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) </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-2551854134096″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”</cite>, line <em class=”line”>203</em>, in <code class=”function”>_new_conn</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>"""Establish a socket connection and set nodelay settings on it.</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>:return: New socket connection.</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>sock = connection.create_connection(</pre> <pre class=”line after”><span class=”ws”> </span>(self._dns_host, self.port),</pre> <pre class=”line after”><span class=”ws”> </span>self.timeout,</pre> <pre class=”line after”><span class=”ws”> </span>source_address=self.source_address,</pre> <pre class=”line after”><span class=”ws”> </span>socket_options=self.socket_options,</pre> <pre class=”line after”><span class=”ws”> </span>)</pre></div> </div> <li><div class=”frame” id=”frame-2551854134208″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py”</cite>, line <em class=”line”>85</em>, in <code class=”function”>create_connection</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>if sock is not None:</pre> <pre class=”line before”><span class=”ws”> </span>sock.close()</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>if err is not None:</pre> <pre class=”line before”><span class=”ws”> </span>try:</pre> <pre class=”line current”><span class=”ws”> </span>raise err</pre> <pre class=”line after”><span class=”ws”> </span>finally:</pre> <pre class=”line after”><span class=”ws”> </span># Break explicitly a reference cycle</pre> <pre class=”line after”><span class=”ws”> </span>err = None</pre> <pre class=”line after”><span class=”ws”> </span>else:</pre> <pre class=”line after”><span class=”ws”> </span>raise OSError("getaddrinfo returns an empty list")</pre></div> </div> <li><div class=”frame” id=”frame-2551854134320″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py”</cite>, line <em class=”line”>73</em>, in <code class=”function”>create_connection</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>if timeout is not _DEFAULT_TIMEOUT:</pre> <pre class=”line before”><span class=”ws”> </span>sock.settimeout(timeout)</pre> <pre class=”line before”><span class=”ws”> </span>if source_address:</pre> <pre class=”line before”><span class=”ws”> </span>sock.bind(source_address)</pre> <pre class=”line current”><span class=”ws”> </span>sock.connect(sa)</pre> <pre class=”line after”><span class=”ws”> </span># Break explicitly a reference cycle</pre> <pre class=”line after”><span class=”ws”> </span>err = None</pre> <pre class=”line after”><span class=”ws”> </span>return sock</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>except OSError as _:</pre></div> </div> <li><div class=”exc-divider”>The above exception was the direct cause of the following exception:</div> <li><div class=”frame” id=”frame-2551854091952″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”</cite>, line <em class=”line”>790</em>, in <code class=”function”>urlopen</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span># it will also try to release it and we'll have a double-release</pre> <pre class=”line before”><span class=”ws”> </span># mess.</pre> <pre class=”line before”><span class=”ws”> </span>response_conn = conn if not release_conn else None</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># Make the request on the HTTPConnection object</pre> <pre class=”line current”><span class=”ws”> </span>response = self._make_request(</pre> <pre class=”line after”><span class=”ws”> </span>conn,</pre> <pre class=”line after”><span class=”ws”> </span>method,</pre> <pre class=”line after”><span class=”ws”> </span>url,</pre> <pre class=”line after”><span class=”ws”> </span>timeout=timeout_obj,</pre> <pre class=”line after”><span class=”ws”> </span>body=body,</pre></div> </div> <li><div class=”frame” id=”frame-2551854092064″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”</cite>, line <em class=”line”>496</em>, in <code class=”function”>_make_request</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>raise new_e</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># conn.request() calls http.client.*.request, not the method in</pre> <pre class=”line before”><span class=”ws”> </span># urllib3.request. It also calls makefile (recv) on the socket.</pre> <pre class=”line before”><span class=”ws”> </span>try:</pre> <pre class=”line current”><span class=”ws”> </span>conn.request(</pre> <pre class=”line after”><span class=”ws”> </span>method,</pre> <pre class=”line after”><span class=”ws”> </span>url,</pre> <pre class=”line after”><span class=”ws”> </span>body=body,</pre> <pre class=”line after”><span class=”ws”> </span>headers=headers,</pre> <pre class=”line after”><span class=”ws”> </span>chunked=chunked,</pre></div> </div> <li><div class=”frame” id=”frame-2551854092176″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”</cite>, line <em class=”line”>395</em>, in <code class=”function”>request</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span># Now that framing headers are out of the way we send all the other headers.</pre> <pre class=”line before”><span class=”ws”> </span>if "user-agent" not in header_keys:</pre> <pre class=”line before”><span class=”ws”> </span>self.putheader("User-Agent", _get_default_user_agent())</pre> <pre class=”line before”><span class=”ws”> </span>for header, value in headers.items():</pre> <pre class=”line before”><span class=”ws”> </span>self.putheader(header, value)</pre> <pre class=”line current”><span class=”ws”> </span>self.endheaders()</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># If we're given a body we start sending that in chunks.</pre> <pre class=”line after”><span class=”ws”> </span>if chunks is not None:</pre> <pre class=”line after”><span class=”ws”> </span>for chunk in chunks:</pre> <pre class=”line after”><span class=”ws”> </span># Sending empty chunks isn't allowed for TE: chunked</pre></div> </div> <li><div class=”frame” id=”frame-2551854133312″> <h4>File <cite class=”filename”>”C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”</cite>, line <em class=”line”>1280</em>, in <code class=”function”>endheaders</code></h4> <div class=”source “><pre class=”line before”><span class=”ws”> </span>"""</pre> <pre class=”line before”><span class=”ws”> </span>if self.__state == _CS_REQ_STARTED:</pre> <pre class=”line before”><span class=”ws”> </span>self.__state = _CS_REQ_SENT</pre> <pre class=”line before”><span class=”ws”> </span>else:</pre> <pre class=”line before”><span class=”ws”> </span>raise CannotSendHeader()</pre> <pre class=”line current”><span class=”ws”> </span>self._send_output(message_body, encode_chunked=encode_chunked)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>def request(self, method, url, body=None, headers={}, *,</pre> <pre class=”line after”><span class=”ws”> </span>encode_chunked=False):</pre> <pre class=”line after”><span class=”ws”> </span>"""Send a complete request to the server."""</pre> <pre class=”line after”><span class=”ws”> </span>self._send_request(method, url, body, headers, encode_chunked)</pre></div> </div> <li><div class=”frame” id=”frame-2551854133536″> <h4>File <cite class=”filename”>”C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”</cite>, line <em class=”line”>1040</em>, in <code class=”function”>_send_output</code></h4> <div class=”source “><pre class=”line before”><span class=”ws”> </span>A message_body may be specified, to be appended to the request.</pre> <pre class=”line before”><span class=”ws”> </span>"""</pre> <pre class=”line before”><span class=”ws”> </span>self._buffer.extend((b"", b""))</pre> <pre class=”line before”><span class=”ws”> </span>msg = b"\r\n".join(self._buffer)</pre> <pre class=”line before”><span class=”ws”> </span>del self._buffer[:]</pre> <pre class=”line current”><span class=”ws”> </span>self.send(msg)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>if message_body is not None:</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># create a consistent interface to message_body</pre> <pre class=”line after”><span class=”ws”> </span>if hasattr(message_body, 'read'):</pre></div> </div> <li><div class=”frame” id=”frame-2551854133648″> <h4>File <cite class=”filename”>”C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”</cite>, line <em class=”line”>980</em>, in <code class=”function”>send</code></h4> <div class=”source “><pre class=”line before”><span class=”ws”> </span>file-like object that supports a .read() method, or an iterable object.</pre> <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>if self.sock is None:</pre> <pre class=”line before”><span class=”ws”> </span>if self.auto_open:</pre> <pre class=”line current”><span class=”ws”> </span>self.connect()</pre> <pre class=”line after”><span class=”ws”> </span>else:</pre> <pre class=”line after”><span class=”ws”> </span>raise NotConnected()</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>if self.debuglevel > 0:</pre> <pre class=”line after”><span class=”ws”> </span>print("send:", repr(data))</pre></div> </div> <li><div class=”frame” id=”frame-2551854133760″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”</cite>, line <em class=”line”>243</em>, in <code class=”function”>connect</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>)</pre> <pre class=”line before”><span class=”ws”> </span>super().set_tunnel(host, port=port, headers=headers)</pre> <pre class=”line before”><span class=”ws”> </span>self._tunnel_scheme = scheme</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>def connect(self) -> None:</pre> <pre class=”line current”><span class=”ws”> </span>self.sock = self._new_conn()</pre> <pre class=”line after”><span class=”ws”> </span>if self._tunnel_host:</pre> <pre class=”line after”><span class=”ws”> </span># If we're tunneling it means we're connected to our proxy.</pre> <pre class=”line after”><span class=”ws”> </span>self._has_connected_to_proxy = True</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># TODO: Fix tunnel so it doesn't depend on self.sock state.</pre></div> </div> <li><div class=”frame” id=”frame-2551854133872″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”</cite>, line <em class=”line”>218</em>, in <code class=”function”>_new_conn</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>self,</pre> <pre class=”line before”><span class=”ws”> </span>f"Connection to {self.host} timed out. (connect timeout={self.timeout})",</pre> <pre class=”line before”><span class=”ws”> </span>) from e</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>except OSError as e:</pre> <pre class=”line current”><span class=”ws”> </span>raise NewConnectionError(</pre> <pre class=”line after”><span class=”ws”> </span>self, f"Failed to establish a new connection: {e}"</pre> <pre class=”line after”><span class=”ws”> </span>) from e</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># Audit hooks are only available in Python 3.8+</pre> <pre class=”line after”><span class=”ws”> </span>if _HAS_SYS_AUDIT:</pre></div> </div> <li><div class=”exc-divider”>The above exception was the direct cause of the following exception:</div> <li><div class=”frame” id=”frame-2551854091504″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py”</cite>, line <em class=”line”>486</em>, in <code class=”function”>send</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>pass</pre> <pre class=”line before”><span class=”ws”> </span>else:</pre> <pre class=”line before”><span class=”ws”> </span>timeout = TimeoutSauce(connect=timeout, read=timeout)</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>resp = conn.urlopen(</pre> <pre class=”line after”><span class=”ws”> </span>method=request.method,</pre> <pre class=”line after”><span class=”ws”> </span>url=url,</pre> <pre class=”line after”><span class=”ws”> </span>body=request.body,</pre> <pre class=”line after”><span class=”ws”> </span>headers=request.headers,</pre> <pre class=”line after”><span class=”ws”> </span>redirect=False,</pre></div> </div> <li><div class=”frame” id=”frame-2551854091616″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”</cite>, line <em class=”line”>844</em>, in <code class=”function”>urlopen</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>) and (conn and conn.proxy and not conn.has_connected_to_proxy):</pre> <pre class=”line before”><span class=”ws”> </span>new_e = _wrap_proxy_error(new_e, conn.proxy.scheme)</pre> <pre class=”line before”><span class=”ws”> </span>elif isinstance(new_e, (OSError, HTTPException)):</pre> <pre class=”line before”><span class=”ws”> </span>new_e = ProtocolError("Connection aborted.", new_e)</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line current”><span class=”ws”> </span>retries = retries.increment(</pre> <pre class=”line after”><span class=”ws”> </span>method, url, error=new_e, _pool=self, _stacktrace=sys.exc_info()[2]</pre> <pre class=”line after”><span class=”ws”> </span>)</pre> <pre class=”line after”><span class=”ws”> </span>retries.sleep()</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># Keep track of the error for the retry warning.</pre></div> </div> <li><div class=”frame” id=”frame-2551854091728″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\urllib3\util\retry.py”</cite>, line <em class=”line”>515</em>, in <code class=”function”>increment</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>history=history,</pre> <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>if new_retry.is_exhausted():</pre> <pre class=”line before”><span class=”ws”> </span>reason = error or ResponseError(cause)</pre> <pre class=”line current”><span class=”ws”> </span>raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>log.debug("Incremented Retry for (url='%s'): %r", url, new_retry)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>return new_retry</pre> <pre class=”line after”><span class=”ws”></span> </pre></div> </div> <li><div class=”exc-divider”>During handling of the above exception, another exception occurred:</div> <li><div class=”frame” id=”frame-2551854088704″> <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-2551854089264″> <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-2551854089152″> <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-2551854089488″> <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-2551854089600″> <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-2551854089712″> <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-2551854089824″> <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-2551854089936″> <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-2551854090048″> <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-2551854090160″> <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-2551854090272″> <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-2551854090496″> <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-2551854090608″> <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-2551854090720″> <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-2551854090832″> <h4>File <cite class=”filename”>”F:\project\wxgzh\model_server.py”</cite>, line <em class=”line”>355</em>, in <code class=”function”>get_new_content_chatglm</code></h4> <div class=”source “><pre class=”line before”><span class=”ws”> </span>"functions": {},</pre> <pre class=”line before”><span class=”ws”> </span>"repetition_penalty": 1.1</pre> <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 current”><span class=”ws”> </span>response = requests.request("POST", chatglm_url, json=payload, headers=headers)</pre> <pre class=”line after”><span class=”ws”> </span>#print(response)</pre> <pre class=”line after”><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></div> </div> <li><div class=”frame” id=”frame-2551854090944″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\api.py”</cite>, line <em class=”line”>59</em>, in <code class=”function”>request</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># By using the 'with' statement we are sure the session is closed, thus we</pre> <pre class=”line before”><span class=”ws”> </span># avoid leaving sockets open which can trigger a ResourceWarning in some</pre> <pre class=”line before”><span class=”ws”> </span># cases, and look like a memory leak in others.</pre> <pre class=”line before”><span class=”ws”> </span>with sessions.Session() as session:</pre> <pre class=”line current”><span class=”ws”> </span>return session.request(method=method, url=url, **kwargs)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”></span>def get(url, params=None, **kwargs):</pre> <pre class=”line after”><span class=”ws”> </span>r"""Sends a GET request.</pre> <pre class=”line after”><span class=”ws”></span> </pre></div> </div> <li><div class=”frame” id=”frame-2551854091168″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py”</cite>, line <em class=”line”>589</em>, in <code class=”function”>request</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”> </span>send_kwargs = {</pre> <pre class=”line before”><span class=”ws”> </span>"timeout": timeout,</pre> <pre class=”line before”><span class=”ws”> </span>"allow_redirects": allow_redirects,</pre> <pre class=”line before”><span class=”ws”> </span>}</pre> <pre class=”line before”><span class=”ws”> </span>send_kwargs.update(settings)</pre> <pre class=”line current”><span class=”ws”> </span>resp = self.send(prep, **send_kwargs)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>return resp</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>def get(self, url, **kwargs):</pre> <pre class=”line after”><span class=”ws”> </span>r"""Sends a GET request. Returns :class:`Response` object.</pre></div> </div> <li><div class=”frame” id=”frame-2551854091280″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py”</cite>, line <em class=”line”>703</em>, in <code class=”function”>send</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># Start time (approximately) of the request</pre> <pre class=”line before”><span class=”ws”> </span>start = preferred_clock()</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span># Send the request</pre> <pre class=”line current”><span class=”ws”> </span>r = adapter.send(request, **kwargs)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span># Total elapsed time of the request (approximately)</pre> <pre class=”line after”><span class=”ws”> </span>elapsed = preferred_clock() – start</pre> <pre class=”line after”><span class=”ws”> </span>r.elapsed = timedelta(seconds=elapsed)</pre> <pre class=”line after”><span class=”ws”></span> </pre></div> </div> <li><div class=”frame” id=”frame-2551854091392″> <h4>File <cite class=”filename”>”F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py”</cite>, line <em class=”line”>519</em>, in <code class=”function”>send</code></h4> <div class=”source library”><pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line before”><span class=”ws”> </span>if isinstance(e.reason, _SSLError):</pre> <pre class=”line before”><span class=”ws”> </span># This branch is for urllib3 v1.22 and later.</pre> <pre class=”line before”><span class=”ws”> </span>raise SSLError(e, request=request)</pre> <pre class=”line before”><span class=”ws”></span> </pre> <pre class=”line current”><span class=”ws”> </span>raise ConnectionError(e, request=request)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>except ClosedPoolError as e:</pre> <pre class=”line after”><span class=”ws”> </span>raise ConnectionError(e, request=request)</pre> <pre class=”line after”><span class=”ws”></span> </pre> <pre class=”line after”><span class=”ws”> </span>except _ProxyError as e:</pre></div> </div> </ul> <blockquote>requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000252265B7820>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) </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\urllib3\connection.py", line 203, in _new_conn sock = connection.create_connection( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py", line 85, in create_connection raise err File "F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py", line 73, in create_connection sock.connect(sa) ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py", line 790, in urlopen response = self._make_request( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py", line 496, in _make_request conn.request( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py", line 395, in request self.endheaders() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1280, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1040, in _send_output self.send(msg) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 980, in send self.connect() File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py", line 243, in connect self.sock = self._new_conn() File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py", line 218, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x00000252265B7820>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File "F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py", line 486, in send resp = conn.urlopen( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py", line 844, in urlopen retries = retries.increment( File "F:\project\wxgzh\venv\lib\site-packages\urllib3\util\retry.py", line 515, in increment raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000252265B7820>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) 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 355, in get_new_content_chatglm response = requests.request("POST", chatglm_url, json=payload, headers=headers) File "F:\project\wxgzh\venv\lib\site-packages\requests\api.py", line 59, in request return session.request(method=method, url=url, **kwargs) File "F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py", line 589, in request resp = self.send(prep, **send_kwargs) File "F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py", line 703, in send r = adapter.send(request, **kwargs) File "F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py", line 519, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x00000252265B7820>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。')) </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\urllib3\connection.py”, line 203, in _new_conn sock = connection.create_connection( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py”, line 85, in create_connection raise err File “F:\project\wxgzh\venv\lib\site-packages\urllib3\util\connection.py”, line 73, in create_connection sock.connect(sa) ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”, line 790, in urlopen response = self._make_request( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”, line 496, in _make_request conn.request( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”, line 395, in request self.endheaders() File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”, line 1280, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”, line 1040, in _send_output self.send(msg) File “C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\http\client.py”, line 980, in send self.connect() File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”, line 243, in connect self.sock = self._new_conn() File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connection.py”, line 218, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x00000252265B7820>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File “F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py”, line 486, in send resp = conn.urlopen( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\connectionpool.py”, line 844, in urlopen retries = retries.increment( File “F:\project\wxgzh\venv\lib\site-packages\urllib3\util\retry.py”, line 515, in increment raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host=’127.0.0.1′, port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0x00000252265B7820>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。’)) 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 355, in get_new_content_chatglm response = requests.request(“POST”, chatglm_url, json=payload, headers=headers) File “F:\project\wxgzh\venv\lib\site-packages\requests\api.py”, line 59, in request return session.request(method=method, url=url, **kwargs) File “F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py”, line 589, in request resp = self.send(prep, **send_kwargs) File “F:\project\wxgzh\venv\lib\site-packages\requests\sessions.py”, line 703, in send r = adapter.send(request, **kwargs) File “F:\project\wxgzh\venv\lib\site-packages\requests\adapters.py”, line 519, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host=’127.0.0.1′, port=7861): Max retries exceeded with url: /v1/chat/completions (Caused by NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0x00000252265B7820>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。’)) –>
至少在5月17日时,该账号IP属地还显示为澳大利亚。
我已经根据您的要求对原文进行了改写。以下是改写后的内容:经过天眼查的查询结果,我们可以得知,南京鹏羽辉科技有限公司是在2022年10月成立的,其注册资本为200万元,而公司的法定代表人则是江锐先生。值得一提的是,该公司两大股东均为自然人,分别是李唱白先生和江锐先生,两人各持有公司50%的股份。
但除此之外,有关这家公司的公开信息非常少。
笔者尝试加入Midjourney QQ频道时,页面显示“暂不支持加入,请关注后续开放时间”。
程序员发文怒斥:是骗子公司在5月16日的夜晚,一位名叫“篮球狂热架构师”的程序员发表了一篇题为《Midjourney中国竟然是虚假的!?》的文章,直接指出所谓的Midjourney中国实际上是一家骗局。
该网友称,自己申请加入了QQ上的“Midjourney频道”,进入后确实可以像官方一样输入命令就能生成图片。
但使用后发现,QQ频道里的Midjourney存在部分命令缺失问题。其次,它的订阅价格不仅不便宜和美版一样价格,更是按次收费。
再加上微信公众号中,内测邀请的文章很快删除;而且如果Midjourney和腾讯方面有官方合作,按理说腾讯也会宣传,但目前为止腾讯方面并没有动静。这名网友便认为所谓的“Midjourney中国”以及背后运营公司南京鹏羽辉就是个李鬼。
这几天,也有多家媒体撰文,怀疑这件事就是彻头彻尾的“骗钱”事件。
别着急下结论,可能真是官方中文版事情到这里,是不是就可以下定论,这是又一次屡见不鲜的利用信息差“割韭菜”事件呢?
其实,关于Midjourney官方到底有没有正式进入中国,或者正在尝试进入中国相关问题,网友们早就进行了广泛讨论。
也有很多网友认为QQ频道中的Midjourney就是官方,并且也对上面那位程序员的说法一一进行了驳斥。
首先,关于Midjourney是否为官方问题,有网友晒出了Midjourney团队每周会议纪要中的官方记录,证明QQ版是官方。
网友也晒出了自己在国外社交平台上咨询Midjourney团队,有关是否在QQ频道上开通的相关问题,对方均确认属实。
其次,关于“爱打篮球的架构师”称,QQ版存在缺少指令问题。网友反驳称,目前的QQ版确实要比海外版相差很多,而且这只是官方在QQ上开一个频道,还达不到高级别的合作,因此,腾讯方面不宣传也正常。
笔者注意到,任何人都可以开通QQ频道,并无特别限制。
第三,关于南京鹏羽辉科技有限公司是一家名不见经传的小公司问题。目前,Midjourney本来就是一个只有11个人的小团队。这样的团队去做跨国业务,通过注册大型合资公司等方式落地可能并不现实。因此,或许Midjourney团队委托给小公司代为经营国内业务也合情合理。
第四,关于内测邀请文章很快删除问题。网友们认为,这是因为Midjourney方面低估了国内使用者的“激情”,导致链接发出后迅速传播,服务器瞬间就“爆满”,无力再开放邀请,所以火速删除。
4月11日,网信办发布关于《生成式人工智能服务管理办法(征求意见稿)》,要求利用生成式人工智能产品向公众提供服务前,应当按照《具有舆论属性或社会动员能力的互联网信息服务安全评估规定》 向国家网信部门申报安全评估,并按照《互联网信息服务算法推荐管理规定》履行算法备案和变更、注销备案手续。
这意味着Midjourney要在中国提供正式服务,在合规方面还需时日,因此当前只能以“测试”模式提供小范围服务。
官方:确实存在QQ版本 具体信息待进一步确认5月17日,之前发文质疑Midjourney中国是骗子公司的网友“爱打篮球的架构师”再次发文,公布了官方对此事的答复。
5月15日,Midjourney团队在回答网友“是否存在QQ版Midjourney”相关问题时回答称,“是的,目前在中国确实有一个官方的QQ应用正在进行封闭测试。”
5月16日,官方再次回应称,“我们很快将提供关于发布Midjourney QQ版的官方信息,请保持关注。目前,如果是非官方链接请勿轻信并充值”。
5月17日,Midjourney团队成员再次回复网友关切称,“Midjourney QQ版目前处于早期封闭测试阶段,目前,我们还没有QQ版的官方链接。建议大家等待我们将官方链接发布在此。我听说QQ官方版会显示为‘已验证’,但是我对QQ并不熟悉,目前已知细节不多。”
“爱打篮球的架构师”对Midjourney团队陆续回应认为,目前确定的是Midjouney和腾讯有合作,也确实有Midjourney QQ版。不过,团队成员也会进一步核实,再将官方QQ链接公布。自己目前仍然认为由南京鹏羽辉科技运营的“Midjourney 中国”是假冒产品。
那么,综合所有信息来看,Midjourney的确存在一个QQ版,但是官方说的“QQ版”是不是就是这个由南京鹏羽辉科技运营的“QQ版”,还需要等待官方进一步确认。
另外,腾讯官方目前也没有针对此事进行说明。
在此之前,笔者建议感兴趣的网友不要轻易尝试付费订阅,避免上当受骗。
AI时代,拥有个人微信机器人AI助手!AI时代不落人后!
免费ChatGPT问答,办公、写作、生活好得力助手!
搜索微信号aigc666aigc999或上边扫码,即可拥有个人AI助手!