更新swag

This commit is contained in:
2025-12-02 14:39:50 +08:00
parent 2734306690
commit 3ace1a35ee
3 changed files with 109 additions and 3 deletions

View File

@@ -1,5 +1,4 @@
{
"schemes": [],
"swagger": "2.0",
"info": {
"description": "这是一个用于管理猪场设备的后端服务。",
@@ -15,8 +14,6 @@
},
"version": "1.0"
},
"host": "",
"basePath": "",
"paths": {
"/api/v1/alarm/threshold/active-alarms": {
"get": {
@@ -3366,6 +3363,59 @@
}
}
},
"/api/v1/feed/recipes/{id}/ai-diagnose": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "使用AI对指定配方进行点评并针对目标猪类型给出建议。",
"produces": [
"application/json"
],
"tags": [
"饲料管理-配方"
],
"summary": "AI点评配方",
"parameters": [
{
"type": "integer",
"description": "配方ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "猪类型ID",
"name": "pig_type_id",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "业务码为200代表AI点评成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/controller.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/dto.ReviewRecipeResponse"
}
}
}
]
}
}
}
}
},
"/api/v1/inventory/stock/adjust": {
"post": {
"security": [
@@ -9160,6 +9210,23 @@
}
}
},
"dto.ReviewRecipeResponse": {
"type": "object",
"properties": {
"ai_model": {
"description": "使用的 AI 模型",
"allOf": [
{
"$ref": "#/definitions/models.AIModel"
}
]
},
"review_message": {
"description": "点评内容",
"type": "string"
}
}
},
"dto.SellPigsRequest": {
"type": "object",
"required": [
@@ -10079,6 +10146,15 @@
}
}
},
"models.AIModel": {
"type": "string",
"enum": [
"Gemini"
],
"x-enum-varnames": [
"AI_MODEL_GEMINI"
]
},
"models.AlarmCode": {
"type": "string",
"enum": [

View File

@@ -327,6 +327,17 @@ import {PaginationDTO, Response} from '../enums';
* @property {string} description - 新生成的配方描述
*/
/**
* @typedef {string} AIModel - AI模型枚举
* @enum {string}
* @property {"Gemini"} Gemini - Gemini模型
*/
/**
* @typedef {object} ReviewRecipeResponse
* @property {AIModel} ai_model - 使用的 AI 模型
* @property {string} review_message - 点评内容
*/
// --- API Functions ---
@@ -656,6 +667,16 @@ export const generatePrioritizedStockRecipe = (pigTypeId) => {
return http.post(`/api/v1/feed/recipes/generate-prioritized-stock/${pigTypeId}`);
};
/**
* 使用AI对指定配方进行点评并针对目标猪类型给出建议。
* @param {number} id - 配方ID
* @param {number} pigTypeId - 猪类型ID
* @returns {Promise<Response<ReviewRecipeResponse>>}
*/
export const aiDiagnoseRecipe = (id, pigTypeId) => {
return http.get(`/api/v1/feed/recipes/${id}/ai-diagnose`, {params: {pig_type_id: pigTypeId}});
};
export const FeedApi = {
getNutrients,
@@ -692,4 +713,5 @@ export const FeedApi = {
deleteRecipe,
generateRecipeFromAllMaterials,
generatePrioritizedStockRecipe,
aiDiagnoseRecipe,
};

View File

@@ -330,6 +330,14 @@ export const AlarmSourceType = {
SYSTEM: '系统',
};
/**
* AI模型
* @enum {string}
*/
export const AIModel = {
GEMINI: 'Gemini',
};
/**
* 操作符
* @enum {string}