前置操作

在使用智能运维之前,需要先注册集群,注册集群后绑定用户需要诊断的集群。另外,还需要绑定用户需要使用的大语言模型。

以用户ID为test_user,会话ID为test_session,集群实例地址为10.x.x.x:1为例。

注册、绑定集群

  1. 注册集群

    curl -X 'POST' 'https://x.x.x.x:x/v1/api/clusters/register' -H 'accept: application/json' -H 'Content-Type: application/json' --cacert /path/xxx.crt --key /path/xxx.key --cert /path/xxx.crt -d '{ "cluster_name": "cluster1", "host": "10.x.x.x", "port": "1", "username": "user", "password": "db_password"}' --pass "***"
    
  2. 绑定集群

    curl -X 'PUT' 'https://x.x.x.x:x/v1/api/clusters?instance=10.x.x.x:1&user_id=test_user&session_id=test_session' -H 'accept: application/json' -H 'Content-Type: application/json' --cacert /path/xxx.crt --key /path/xxx.key --cert /path/xxx.crt --pass "***"
    

    如果返回结果中data值为True,说明绑定成功。如果需要换绑其他集群,仅需修改instance参数值,重新调用该接口即可。如果用户创建新会话,不重新绑定集群的话,默认使用上次绑定的集群。

绑定大语言模型

  1. 查询可用的大语言模型

    curl -X 'GET' 'https://x.x.x.x:x/v1/api/llms' -H 'accept: application/json' -H 'Content-Type: application/json' --cacert /path/xxx.crt --key /path/xxx.key --cert /path/xxx.crt --pass "***"
    
  2. 绑定大语言模型

    curl -X 'PUT' 'https://x.x.x.x:x/v1/api/llms?name=xxx&user_id=xxx&session_id=xxx' -H 'accept: application/json' -H 'Content-Type: application/json' --cacert /path/xxx.crt --key /path/xxx.key --cert /path/xxx.crt --pass "***"
    

    如果返回结果中data值为True,说明绑定成功。如果需要换绑其他大语言模型,仅需修改name参数值,重新调用该接口即可。

    如果不绑定大语言模型,直接调用app/intelligent-interaction接口,使用配置文件中默认配置的大语言模型。

意见反馈
编组 3备份
    openGauss 2025-06-07 22:42:34
    取消