From a12cb5e75a76522554c014b6a20f4ad06f4799fb Mon Sep 17 00:00:00 2001
From: sion <450702724@qq.com>
Date: Wed, 11 Mar 2026 00:42:46 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
frontend/app/web-gold/src/api/agent.js | 13 +
frontend/app/web-gold/src/api/dify.js | 86 +++++
frontend/app/web-gold/src/api/forecast.js | 7 +-
frontend/app/web-gold/src/api/userPrompt.js | 8 +
.../src/components/MyFavoritesModal.vue | 306 +++++++++++++++
.../web-gold/src/components/StyleSelector.vue | 283 ++++++++++++++
.../components/agents/MyFavoritesModal.vue | 303 +++++++++++++++
.../app/web-gold/src/views/agents/Agents.vue | 69 +++-
.../app/web-gold/src/views/auth/Login.vue | 2 -
.../components/BatchAnalyzeModal.vue | 50 +--
.../web-gold/src/views/kling/IdentifyFace.vue | 1 -
.../web-gold/src/views/trends/Forecast.vue | 95 ++---
.../dify/controller/AppDifyController.java | 16 +
.../module/tik/dify/service/DifyService.java | 20 +
.../tik/dify/service/DifyServiceImpl.java | 347 +++++++++++++++++-
.../tik/dify/vo/DifyBenchmarkReqVO.java | 23 ++
.../tik/dify/vo/ForecastRewriteReqVO.java | 7 +-
.../tik/dify/vo/PromptAnalysisReqVO.java | 21 ++
.../module/tik/enums/AiModelTypeEnum.java | 6 +
.../controller/AppUserPromptController.java | 8 +
.../userprompt/mapper/UserPromptMapper.java | 10 +
.../userprompt/service/UserPromptService.java | 8 +
.../service/UserPromptServiceImpl.java | 5 +
23 files changed, 1593 insertions(+), 101 deletions(-)
create mode 100644 frontend/app/web-gold/src/api/dify.js
create mode 100644 frontend/app/web-gold/src/components/MyFavoritesModal.vue
create mode 100644 frontend/app/web-gold/src/components/StyleSelector.vue
create mode 100644 frontend/app/web-gold/src/components/agents/MyFavoritesModal.vue
create mode 100644 yudao-module-tik/src/main/java/cn/iocoder/yudao/module/tik/dify/vo/DifyBenchmarkReqVO.java
create mode 100644 yudao-module-tik/src/main/java/cn/iocoder/yudao/module/tik/dify/vo/PromptAnalysisReqVO.java
diff --git a/frontend/app/web-gold/src/api/agent.js b/frontend/app/web-gold/src/api/agent.js
index 30919c6986..c04bcd0f81 100644
--- a/frontend/app/web-gold/src/api/agent.js
+++ b/frontend/app/web-gold/src/api/agent.js
@@ -139,3 +139,16 @@ export function removeFavorite(agentId) {
params: { agentId }
})
}
+
+/**
+ * 获取收藏的智能体列表
+ * 直接从 getAgentList 结果中过滤 isFavorite 为 true 的项
+ */
+export async function getFavoriteList() {
+ const res = await getAgentList()
+ if (res.code === 0 && res.data) {
+ const favorites = res.data.filter(item => item.isFavorite)
+ return { code: 0, data: favorites }
+ }
+ return res
+}
diff --git a/frontend/app/web-gold/src/api/dify.js b/frontend/app/web-gold/src/api/dify.js
new file mode 100644
index 0000000000..1cf601525e
--- /dev/null
+++ b/frontend/app/web-gold/src/api/dify.js
@@ -0,0 +1,86 @@
+/**
+ * Dify API
+ */
+import { fetchEventSource } from '@microsoft/fetch-event-source'
+import tokenManager from '@gold/utils/token-manager'
+import { API_BASE } from '@gold/config/api'
+
+const BASE_URL = `${API_BASE.APP_TIK}`
+
+/**
+ * 对标分析流式 API
+ * @param {Object} options - 请求配置
+ * @param {string} options.content - 合并后的文案内容
+ * @param {number} options.videoCount - 视频数量
+ * @param {AbortController} [options.ctrl] - 取消控制器
+ * @param {Function} options.onMessage - 消息回调
+ * @param {Function} [options.onError] - 错误回调
+ * @param {Function} [options.onComplete] - 完成回调
+ */
+export async function benchmarkAnalyzeStream(options) {
+ const {
+ content,
+ videoCount,
+ ctrl,
+ onMessage,
+ onError,
+ onComplete
+ } = options || {}
+
+ const token = tokenManager.getAccessToken()
+ let fullText = ''
+ let conversationId = ''
+
+ return fetchEventSource(`${BASE_URL}/dify/benchmark/analyze`, {
+ method: 'post',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'Authorization': `Bearer ${token}`,
+ 'tenant-id': import.meta.env?.VITE_TENANT_ID
+ },
+ openWhenHidden: true,
+ body: JSON.stringify({
+ content,
+ videoCount
+ }),
+ onmessage: (event) => {
+ if (typeof onMessage === 'function') {
+ try {
+ const data = JSON.parse(event.data)
+ // 解析 CommonResult 包装
+ const result = data.code === 0 ? data.data : data
+
+ // 处理消息内容
+ if (result.event === 'message' || result.event === 'agent_message') {
+ fullText += result.content || ''
+ onMessage(fullText, result.content)
+ }
+ // 处理完成事件
+ else if (result.event === 'done') {
+ conversationId = result.conversationId
+ }
+ // 处理错误事件
+ else if (result.event === 'error') {
+ if (typeof onError === 'function') {
+ onError(new Error(result.content || '分析失败'))
+ }
+ }
+ } catch (e) {
+ console.error('解析 SSE 数据失败:', e)
+ }
+ }
+ },
+ onerror: (err) => {
+ if (typeof onError === 'function') {
+ onError(err)
+ }
+ throw err // 不重试
+ },
+ onclose: () => {
+ if (typeof onComplete === 'function') {
+ onComplete(fullText, conversationId)
+ }
+ },
+ signal: ctrl ? ctrl.signal : undefined
+ })
+}
diff --git a/frontend/app/web-gold/src/api/forecast.js b/frontend/app/web-gold/src/api/forecast.js
index 8fb0595602..75e304098b 100644
--- a/frontend/app/web-gold/src/api/forecast.js
+++ b/frontend/app/web-gold/src/api/forecast.js
@@ -10,10 +10,11 @@ const BASE_URL = `${API_BASE.APP_TIK}`
/**
* 流式文案改写(SSE)
* @param {Object} options - 请求配置
- * @param {number} options.agentId - 智能体ID
+ * @param {number} [options.agentId] - 智能体ID(使用用户风格时可不传)
* @param {string} options.userText - 用户输入文案
* @param {number} [options.level] - 改写级别/强度
* @param {string} [options.modelType] - 模型类型:forecast_standard/forecast_pro
+ * @param {string} [options.customSystemPrompt] - 自定义系统提示词(使用用户风格时传入)
* @param {AbortController} [options.ctrl] - 取消控制器
* @param {Function} options.onMessage - 消息回调
* @param {Function} [options.onError] - 错误回调
@@ -25,6 +26,7 @@ export async function rewriteStream(options) {
userText,
level = 50,
modelType = 'forecast_standard',
+ customSystemPrompt,
ctrl,
onMessage,
onError,
@@ -45,7 +47,8 @@ export async function rewriteStream(options) {
agentId,
userText,
level,
- modelType
+ modelType,
+ customSystemPrompt
}),
onmessage: (event) => {
if (typeof onMessage === 'function') {
diff --git a/frontend/app/web-gold/src/api/userPrompt.js b/frontend/app/web-gold/src/api/userPrompt.js
index 5af62a90da..4972aead0f 100644
--- a/frontend/app/web-gold/src/api/userPrompt.js
+++ b/frontend/app/web-gold/src/api/userPrompt.js
@@ -40,6 +40,14 @@ export const UserPromptApi = {
return await http.get(`${SERVER_BASE_AI}/user-prompt/page`, { params })
},
+ /**
+ * 获取用户提示词列表(简化版,不分页)
+ * @returns {Promise} 响应数据
+ */
+ getUserPromptList: async () => {
+ return await http.get(`${SERVER_BASE_AI}/user-prompt/list`)
+ },
+
/**
* 获取单个用户提示词
* @param {Number} id - 提示词ID
diff --git a/frontend/app/web-gold/src/components/MyFavoritesModal.vue b/frontend/app/web-gold/src/components/MyFavoritesModal.vue
new file mode 100644
index 0000000000..a9a0a11df4
--- /dev/null
+++ b/frontend/app/web-gold/src/components/MyFavoritesModal.vue
@@ -0,0 +1,306 @@
+
+
+
+
+
+
+
+ 新建风格
+
+
+
+ 刷新
+
+
+
+
+
+
+
+
{{ item.content }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/app/web-gold/src/components/StyleSelector.vue b/frontend/app/web-gold/src/components/StyleSelector.vue
new file mode 100644
index 0000000000..d9e1502d4d
--- /dev/null
+++ b/frontend/app/web-gold/src/components/StyleSelector.vue
@@ -0,0 +1,283 @@
+
+
+
+
+
+ 用户风格
+
+
+
+ {{ item.name }}
+ 风格
+
+
+
+
+
+
+
+ 收藏的智能体
+
+
+
+
![]()
+
{{ item.name }}
+
{{ item.categoryName || '智能体' }}
+
+
+
+
+
+
+
+ 暂无可选项
+
+
+
+
+
+
+
+
diff --git a/frontend/app/web-gold/src/components/agents/MyFavoritesModal.vue b/frontend/app/web-gold/src/components/agents/MyFavoritesModal.vue
new file mode 100644
index 0000000000..a2ed7829f8
--- /dev/null
+++ b/frontend/app/web-gold/src/components/agents/MyFavoritesModal.vue
@@ -0,0 +1,303 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ item.content }}
+
+
+
+
+
+
+
+
暂无收藏的风格
+
点击"新建风格"创建您的第一个风格
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/app/web-gold/src/views/agents/Agents.vue b/frontend/app/web-gold/src/views/agents/Agents.vue
index 923b6d2bd9..72e7f8799c 100644
--- a/frontend/app/web-gold/src/views/agents/Agents.vue
+++ b/frontend/app/web-gold/src/views/agents/Agents.vue
@@ -26,6 +26,12 @@
+
+
+
@@ -183,6 +189,12 @@
:agent-id="historyAgentId"
@close="closeHistoryPanel"
/>
+
+
@@ -202,6 +214,7 @@ import { message } from 'ant-design-vue'
import FullWidthLayout from '@/layouts/components/FullWidthLayout.vue'
import ChatDrawer from '@/components/agents/ChatDrawer.vue'
import HistoryPanel from '@/components/agents/HistoryPanel.vue'
+import MyFavoritesModal from '@/components/agents/MyFavoritesModal.vue'
import { getAgentList, addFavorite, removeFavorite } from '@/api/agent'
// 状态管理
@@ -216,6 +229,7 @@ const showCategoryPanel = ref(false)
const panelTop = ref(0)
const historyPanelVisible = ref(false)
const historyAgentId = ref(null)
+const showFavoritesModal = ref(false)
// 面板样式
const panelStyle = computed(() => ({
@@ -385,6 +399,15 @@ const handleFavorite = async (agent) => {
}
}
+// 收藏被移除的回调
+const handleFavoriteRemoved = (agent) => {
+ // 同步更新列表中的收藏状态
+ const target = agentList.value.find(a => a.id === agent.id)
+ if (target) {
+ target.isFavorite = false
+ }
+}
+
// 初始化
onMounted(() => {
fetchAgentList()
@@ -459,14 +482,18 @@ onMounted(() => {
// 搜索区域 - 核心焦点
// ============================================
.search-hero {
- max-width: 480px;
+ max-width: 560px;
margin: 0 auto 28px;
+ display: flex;
+ align-items: center;
+ gap: 12px;
}
.search-input-group {
position: relative;
display: flex;
align-items: center;
+ flex: 1;
}
.search-icon {
@@ -532,6 +559,46 @@ onMounted(() => {
}
}
+// ============================================
+// 收藏按钮
+// ============================================
+.favorites-btn {
+ flex-shrink: 0;
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ padding: 0 16px;
+ height: 52px;
+ border: 1px solid var(--color-gray-300);
+ border-radius: var(--radius-lg);
+ background: var(--color-bg-card);
+ cursor: pointer;
+ transition: all var(--duration-fast);
+ box-shadow: var(--shadow-sm);
+
+ &:hover {
+ border-color: #f59e0b;
+ background: #fffbeb;
+ box-shadow: var(--shadow-md);
+ }
+
+ &:active {
+ transform: scale(0.98);
+ }
+}
+
+.favorites-btn-icon {
+ font-size: 18px;
+ color: #f59e0b;
+}
+
+.favorites-btn-text {
+ font-size: 14px;
+ font-weight: 500;
+ color: var(--color-gray-700);
+ white-space: nowrap;
+}
+
// ============================================
// 分类筛选 - 精简胶囊
// ============================================
diff --git a/frontend/app/web-gold/src/views/auth/Login.vue b/frontend/app/web-gold/src/views/auth/Login.vue
index 479c5e6042..f4fc7ed241 100644
--- a/frontend/app/web-gold/src/views/auth/Login.vue
+++ b/frontend/app/web-gold/src/views/auth/Login.vue
@@ -429,8 +429,6 @@ async function handleSmsLogin() {