Compare commits

...

2 Commits

Author SHA1 Message Date
038f205413 feat(ai-agent): 在创建和更新智能体时自动设置操作人信息
Some checks failed
Build and Deploy / deploy (push) Has been cancelled
移除 AiAgentSaveReqVO 中 icon、description、systemPrompt、operatorId 和 operatorName 字段的必填校验,改为由服务层自动获取当前登录用户的信息进行填充。
2026-05-01 14:38:30 +08:00
8f8b0a03e4 feat(agent): 将收藏夹卡片使用次数改为显示创建时间
在收藏夹列表中,将使用次数显示替换为创建时间戳,使用 dayjs 格式化显示,并调整卡片底部布局为两端对齐。
2026-04-27 20:00:36 +08:00
3 changed files with 13 additions and 13 deletions

View File

@@ -1,6 +1,7 @@
<script setup>
import { ref, computed, watch } from 'vue'
import { toast } from 'vue-sonner'
import dayjs from 'dayjs'
import { Icon } from '@iconify/vue'
import { UserPromptApi } from '@/api/userPrompt'
@@ -62,7 +63,7 @@ async function loadList() {
name: item.name,
content: item.content,
category: item.category,
useCount: item.useCount || 0
createTime: item.createTime
}))
}
} catch (error) {
@@ -172,7 +173,7 @@ function handleUse(item) {
</div>
</div>
<div class="card-footer">
<span class="text-xs text-muted-foreground">使用 {{ item.useCount || 0 }} </span>
<span class="text-xs text-muted-foreground" v-if="item.createTime">{{ dayjs(item.createTime).format('YYYY-MM-DD HH:mm') }}</span>
</div>
</div>
</div>
@@ -243,7 +244,7 @@ function handleUse(item) {
.card-footer {
display: flex;
justify-content: flex-end;
justify-content: space-between;
align-items: center;
margin-top: 8px;
padding-top: 8px;

View File

@@ -35,6 +35,8 @@ public class AiAgentServiceImpl implements AiAgentService {
public Long createAiAgent(AiAgentSaveReqVO createReqVO) {
// 插入
AiAgentDO aiAgent = BeanUtils.toBean(createReqVO, AiAgentDO.class);
aiAgent.setOperatorId(SecurityFrameworkUtils.getLoginUserId());
aiAgent.setOperatorName(String.valueOf(SecurityFrameworkUtils.getLoginUserNickname()));
aiAgentMapper.insert(aiAgent);
// 返回
@@ -47,6 +49,8 @@ public class AiAgentServiceImpl implements AiAgentService {
validateAiAgentExists(updateReqVO.getId());
// 更新
AiAgentDO updateObj = BeanUtils.toBean(updateReqVO, AiAgentDO.class);
updateObj.setOperatorId(SecurityFrameworkUtils.getLoginUserId());
updateObj.setOperatorName(String.valueOf(SecurityFrameworkUtils.getLoginUserNickname()));
aiAgentMapper.updateById(updateObj);
}

View File

@@ -19,20 +19,17 @@ public class AiAgentSaveReqVO {
@NotEmpty(message = "智能体名称不能为空")
private String agentName;
@Schema(description = "图标URL", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "图标URL不能为空")
@Schema(description = "图标URL", example = "https://example.com/icon.png")
private String icon;
@Schema(description = "状态(0-禁用 1-启用)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "状态(0-禁用 1-启用)不能为空")
private Integer status;
@Schema(description = "设定描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
@NotEmpty(message = "设定描述不能为空")
@Schema(description = "设定描述", example = "你说的对")
private String description;
@Schema(description = "预置提示词", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "预置提示词不能为空")
@Schema(description = "预置提示词")
private String systemPrompt;
@Schema(description = "备注", example = "你说的对")
@@ -41,12 +38,10 @@ public class AiAgentSaveReqVO {
@Schema(description = "分类名称(中文)", example = "文案创作")
private String categoryName;
@Schema(description = "操作人用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "6593")
@NotNull(message = "操作人用户编号不能为空")
@Schema(description = "操作人用户编号", example = "6593")
private Long operatorId;
@Schema(description = "操作人账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
@NotEmpty(message = "操作人账号不能为空")
@Schema(description = "操作人账号", example = "赵六")
private String operatorName;
}