1. 知识库
llmops
  • app应用模块
    • 基础聊天接口
      POST
    • 创建app
      POST
    • 获取app详情
      GET
    • 更新app
      POST
    • 删除app
      DELETE
  • 内置工具模块
    • 获取所有内置工具信息
      GET
    • 获取指定工具信息
      GET
    • 获取提供者的图标
      GET
    • 获取分类信息
      GET
  • 自定义api工具模块
    • 校验openapi-schema格式
      POST
    • 创建自定义api工具
      POST
    • 获取api提供者信息 根据uuid
      GET
    • 获取指定API工具详情
      GET
    • 查询分页
      GET
    • 更新apiprovider
      POST
  • 上传文件模块
    • 上传文件
      POST
    • 上传图片
      POST
  • 知识库/文档 模块
    • 知识库
      • 创建知识库
        POST
      • 获取知识库详情
        GET
      • 更新知识库
        POST
      • 分页搜索知识库
        GET
    • 文档
      • 指定知识库下新增文档
      • 修改文档名称
      • 获取指定文档基础信息
      • 获取知识库下的文档列表
    • 知识库召回测试
      POST
    • 根据批处理id 获取进度
      GET
    • 结巴分词/embedding 测试
      GET
  • 测试接口
    GET
  • 有道翻译接口
    GET
  1. 知识库

更新知识库

开发中
POST
/datasets/{dataset_id}

请求参数

Path 参数

Body 参数application/json必填

示例
{

    "description": "手套",

    "icon": "https://loremflickr.com/280/2528?lock=1251995980091426",
    "name": "手套"
  }

请求示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'http://localhost:5000/datasets/713cd447-c59c-4368-9f9e-c9d06e1cc0f6' \
--header 'Content-Type: application/json' \
--data-raw '{

    "description": "手套",

    "icon": "https://loremflickr.com/280/2528?lock=1251995980091426",
    "name": "手套"
  }'

返回响应

🟢200成功
application/json
Body

示例
<!doctype html>
<html lang=en>
  <head>
    <title>exception.exception.ValidateException: 手套该知识库已存在
 // Werkzeug Debugger</title>
    <link rel="stylesheet" href="?__debugger__=yes&amp;cmd=resource&amp;f=style.css">
    <link rel="shortcut icon"
        href="?__debugger__=yes&amp;cmd=resource&amp;f=console.png">
    <script src="?__debugger__=yes&amp;cmd=resource&amp;f=debugger.js"></script>
    <script>
      var CONSOLE_MODE = false,
          EVALEX = true,
          EVALEX_TRUSTED = false,
          SECRET = "B6B2qzjetxYBUGaIyb8n";
    </script>
  </head>
  <body style="background-color: #fff">
    <div class="debugger">
<h1>exception.exception.ValidateException</h1>
<div class="detail">
  <p class="errormsg">exception.exception.ValidateException: 手套该知识库已存在
</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-2126584991888">
  <h4>File <cite class="filename">"D:\code\llm-ops\llmops-api\.venv\Lib\site-packages\flask\app.py"</cite>,
      line <em class="line">1536</em>,
      in <code class="function">__call__</code></h4>
  <div class="source library"><pre class="line before"><span class="ws">    </span>) -&gt; cabc.Iterable[bytes]:</pre>
<pre class="line before"><span class="ws">        </span>&#34;&#34;&#34;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>&#34;&#34;&#34;</pre>
<pre class="line current"><span class="ws">        </span>return self.wsgi_app(environ, start_response)
<span class="ws">        </span>       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</pre></div>
</div>

<li><div class="frame" id="frame-2126584993616">
  <h4>File <cite class="filename">"D:\code\llm-ops\llmops-api\.venv\Lib\site-packages\flask\app.py"</cite>,
      line <em class="line">1514</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)
<span class="ws">                </span>           ^^^^^^^^^^^^^^^^^^^^^^^^</pre>
<pre class="line after"><span class="ws">            </span>except:</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-2126584996928">
  <h4>File <cite class="filename">"D:\code\llm-ops\llmops-api\.venv\Lib\site-packages\flask\app.py"</cite>,
      line <em class="line">1511</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()
<span class="ws">                </span>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^</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:</pre>
<pre class="line after"><span class="ws">                </span>error = sys.exc_info()[1]</pre></div>
</div>

<li><div class="frame" id="frame-2126584992320">
  <h4>File <cite class="filename">"D:\code\llm-ops\llmops-api\.venv\Lib\site-packages\flask\app.py"</cite>,
      line <em class="line">919</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)
<span class="ws">            </span>     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</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-2126584988720">
  <h4>File <cite class="filename">"D:\code\llm-ops\llmops-api\.venv\Lib\site-packages\flask\app.py"</cite>,
      line <em class="line">809</em>,
      in <code class="function">handle_user_exception</code></h4>
  <div class="source library"><pre class="line before"><span class="ws">        </span>handler = self._find_error_handler(e, request.blueprints)</pre>
<pre class="line before"><span class="ws"></span> </pre>
<pre class="line before"><span class="ws">        </span>if handler is None:</pre>
<pre class="line before"><span class="ws">            </span>raise</pre>
<pre class="line before"><span class="ws"></span> </pre>
<pre class="line current"><span class="ws">        </span>return self.ensure_sync(handler)(e)  # type: ignore[no-any-return]
<span class="ws">        </span>       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws">    </span>def handle_exception(self, e: Exception) -&gt; Response:</pre>
<pre class="line after"><span class="ws">        </span>&#34;&#34;&#34;Handle an exception that did not have an error handler</pre>
<pre class="line after"><span class="ws">        </span>associated with it, or that was raised from an error handler.</pre>
<pre class="line after"><span class="ws">        </span>This always causes a 500 ``InternalServerError``.</pre></div>
</div>

<li><div class="frame" id="frame-2126584989152">
  <h4>File <cite class="filename">"D:\code\llm-ops\llmops-api\internal\server\http.py"</cite>,
      line <em class="line">75</em>,
      in <code class="function">_register_error_handler</code></h4>
  <div class="source "><pre class="line before"><span class="ws">                </span>code=error.code,</pre>
<pre class="line before"><span class="ws">                </span>message=error.message,</pre>
<pre class="line before"><span class="ws">                </span>data=error.data if error.data is not None else {}</pre>
<pre class="line before"><span class="ws">            </span>))</pre>
<pre class="line before"><span class="ws">        </span>if self.debug or os.getenv(&#34;FLASK_ENV&#34;) == &#34;development&#34;:</pre>
<pre class="line current"><span class="ws">            </span>raise error
<span class="ws">            </span>^^^^^^^^^^^</pre>
<pre class="line after"><span class="ws">        </span>else:</pre>
<pre class="line after"><span class="ws">            </span>return json(Response(</pre>
<pre class="line after"><span class="ws">                </span>code=HttpCode.FAIL,</pre>
<pre class="line after"><span class="ws">                </span>message=str(error),</pre>
<pre class="line after"><span class="ws">                </span>data={}</pre></div>
</div>

<li><div class="frame" id="frame-2126584994768">
  <h4>File <cite class="filename">"D:\code\llm-ops\llmops-api\.venv\Lib\site-packages\flask\app.py"</cite>,
      line <em class="line">917</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()
<span class="ws">                </span>     ^^^^^^^^^^^^^^^^^^^^^^^</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-2126584991024">
  <h4>File <cite class="filename">"D:\code\llm-ops\llmops-api\.venv\Lib\site-packages\flask\app.py"</cite>,
      line <em class="line">902</em>,
      in <code class="function">dispatch_request</code></h4>
  <div class="source library"><pre class="line before"><span class="ws">            </span>and req.method == &#34;OPTIONS&#34;</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)  # type: ignore[no-any-return]
<span class="ws">        </span>       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws">    </span>def full_dispatch_request(self) -&gt; Response:</pre>
<pre class="line after"><span class="ws">        </span>&#34;&#34;&#34;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-2126584990448">
  <h4>File <cite class="filename">"D:\code\llm-ops\llmops-api\internal\handler\dataset_handler.py"</cite>,
      line <em class="line">45</em>,
      in <code class="function">update_dataset</code></h4>
  <div class="source "><pre class="line before"><span class="ws">    </span>def update_dataset(self, dataset_id: UUID):</pre>
<pre class="line before"><span class="ws">        </span>req = UpdateDatasetReq()</pre>
<pre class="line before"><span class="ws">        </span>if not req.validate():</pre>
<pre class="line before"><span class="ws">            </span>return validate_error_json(req.errors)</pre>
<pre class="line before"><span class="ws"></span> </pre>
<pre class="line current"><span class="ws">        </span>dataset = self.dataset_service.update_dataset(dataset_id, req)
<span class="ws">        </span>          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</pre>
<pre class="line after"><span class="ws">        </span>return success_message(f&#34;{dataset.name}更新成功&#34;)</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> </pre>
<pre class="line after"><span class="ws"></span> </pre></div>
</div>

<li><div class="frame" id="frame-2126584988576">
  <h4>File <cite class="filename">"D:\code\llm-ops\llmops-api\internal\service\dataset_service.py"</cite>,
      line <em class="line">62</em>,
      in <code class="function">update_dataset</code></h4>
  <div class="source "><pre class="line before"><span class="ws">            </span>Dataset.account_id == account_id,</pre>
<pre class="line before"><span class="ws">            </span>Dataset.name == req.name.data,</pre>
<pre class="line before"><span class="ws">            </span>Dataset.id != dataset_id</pre>
<pre class="line before"><span class="ws">        </span>).one_or_none()</pre>
<pre class="line before"><span class="ws">        </span>if check_dataset:</pre>
<pre class="line current"><span class="ws">            </span>raise ValidateException(f&#34;{req.name.data}该知识库已存在&#34;)
<span class="ws">            </span>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</pre>
<pre class="line after"><span class="ws"></span> </pre>
<pre class="line after"><span class="ws">        </span>if req.description.data is None or req.description.data.strip() == &#34;&#34;:</pre>
<pre class="line after"><span class="ws">            </span>req.description.data = DEFAULT_DATASET_DESCRIPTION_FORMATTER.format(</pre>
<pre class="line after"><span class="ws">                </span>name = req.name.data</pre>
<pre class="line after"><span class="ws">            </span>)</pre></div>
</div>
</ul>
  <blockquote>exception.exception.ValidateException: 手套该知识库已存在
</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 &#34;D:\code\llm-ops\llmops-api\.venv\Lib\site-packages\flask\app.py&#34;, line 1536, in __call__
    return self.wsgi_app(environ, start_response)
           ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File &#34;D:\code\llm-ops\llmops-api\.venv\Lib\site-packages\flask\app.py&#34;, line 1514, in wsgi_app
    response = self.handle_exception(e)
  File &#34;D:\code\llm-ops\llmops-api\.venv\Lib\site-packages\flask\app.py&#34;, line 1511, in wsgi_app
    response = self.full_dispatch_request()
  File &#34;D:\code\llm-ops\llmops-api\.venv\Lib\site-packages\flask\app.py&#34;, line 919, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File &#34;D:\code\llm-ops\llmops-api\.venv\Lib\site-packages\flask\app.py&#34;, line 809, in handle_user_exception
    return self.ensure_sync(handler)(e)  # type: ignore[no-any-return]
           ~~~~~~~~~~~~~~~~~~~~~~~~~^^^
  File &#34;D:\code\llm-ops\llmops-api\internal\server\http.py&#34;, line 75, in _register_error_handler
    raise error
  File &#34;D:\code\llm-ops\llmops-api\.venv\Lib\site-packages\flask\app.py&#34;, line 917, in full_dispatch_request
    rv = self.dispatch_request()
  File &#34;D:\code\llm-ops\llmops-api\.venv\Lib\site-packages\flask\app.py&#34;, line 902, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File &#34;D:\code\llm-ops\llmops-api\internal\handler\dataset_handler.py&#34;, line 45, in update_dataset
    dataset = self.dataset_service.update_dataset(dataset_id, req)
  File &#34;D:\code\llm-ops\llmops-api\internal\service\dataset_service.py&#34;, line 62, in update_dataset
    raise ValidateException(f&#34;{req.name.data}该知识库已存在&#34;)
exception.exception.ValidateException: 手套该知识库已存在
</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 "D:\code\llm-ops\llmops-api\.venv\Lib\site-packages\flask\app.py", line 1536, in __call__
    return self.wsgi_app(environ, start_response)
           ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\code\llm-ops\llmops-api\.venv\Lib\site-packages\flask\app.py", line 1514, in wsgi_app
    response = self.handle_exception(e)
  File "D:\code\llm-ops\llmops-api\.venv\Lib\site-packages\flask\app.py", line 1511, in wsgi_app
    response = self.full_dispatch_request()
  File "D:\code\llm-ops\llmops-api\.venv\Lib\site-packages\flask\app.py", line 919, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "D:\code\llm-ops\llmops-api\.venv\Lib\site-packages\flask\app.py", line 809, in handle_user_exception
    return self.ensure_sync(handler)(e)  # type: ignore[no-any-return]
           ~~~~~~~~~~~~~~~~~~~~~~~~~^^^
  File "D:\code\llm-ops\llmops-api\internal\server\http.py", line 75, in _register_error_handler
    raise error
  File "D:\code\llm-ops\llmops-api\.venv\Lib\site-packages\flask\app.py", line 917, in full_dispatch_request
    rv = self.dispatch_request()
  File "D:\code\llm-ops\llmops-api\.venv\Lib\site-packages\flask\app.py", line 902, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "D:\code\llm-ops\llmops-api\internal\handler\dataset_handler.py", line 45, in update_dataset
    dataset = self.dataset_service.update_dataset(dataset_id, req)
  File "D:\code\llm-ops\llmops-api\internal\service\dataset_service.py", line 62, in update_dataset
    raise ValidateException(f"{req.name.data}该知识库已存在")
exception.exception.ValidateException: 手套该知识库已存在


-->
修改于 2026-04-22 06:58:03
上一页
获取知识库详情
下一页
分页搜索知识库
Built with