@PostMapping("/system_config/ai")
    public ActionResult addChatGptSystemConfig(@RequestBody AIConfigCreateRequest request) {
        PermissionUtils.checkDeskTopOrAdmin();

        String sqlSource = request.getAiSqlSource();
        AiSqlSourceEnum aiSqlSourceEnum = AiSqlSourceEnum.getByName(sqlSource);
        if (Objects.isNull(aiSqlSourceEnum)) {
            sqlSource = AiSqlSourceEnum.CHAT2DBAI.getCode();
            aiSqlSourceEnum = AiSqlSourceEnum.CHAT2DBAI;
        }
        SystemConfigParam param = SystemConfigParam.builder().code(RestAIClient.AI_SQL_SOURCE).content(sqlSource)
            .build();
        configService.createOrUpdate(param);

        switch (Objects.requireNonNull(aiSqlSourceEnum)) {
            case OPENAI:
                saveOpenAIConfig(request);
                break;
            case CHAT2DBAI:
                saveChat2dbAIConfig(request);
                break;
            case RESTAI:
                saveRestAIConfig(request);
                break;
            case AZUREAI:
                saveAzureAIConfig(request);
                break;
            case FASTCHATAI:
                saveFastChatAIConfig(request);
                break;
            case TONGYIQIANWENAI:
                saveTongyiChatAIConfig(request);
                break;
            case WENXINAI:
                saveWenxinAIConfig(request);
                break;
            case BAICHUANAI:
                saveBaichuanAIConfig(request);
                break;
            case ZHIPUAI:
                saveZhipuChatAIConfig(request);
                break;
        }
        return ActionResult.isSuccess();
    }
Save ChatGPT related configurations

@param request
@return
chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/config/ConfigController.java