hotkeyword

This commit is contained in:
2025-03-14 22:02:10 +08:00
parent 942fb592b5
commit bd1a5ce384
5 changed files with 496 additions and 0 deletions

View File

@@ -3178,6 +3178,148 @@ export const openAPISpec = {
}
}
},
'/api/analytics/hot-keywords': {
get: {
summary: '获取热门关键词',
description: '返回按出现频率排序的热门关键词列表,包含关键词、出现次数、占比和情感分数',
tags: ['Analytics'],
parameters: [
{
name: 'timeRange',
in: 'query',
description: '时间范围(天)',
schema: {
type: 'integer',
enum: [7, 30, 90],
default: 30
}
},
{
name: 'projectId',
in: 'query',
description: '项目ID可选',
schema: {
type: 'string'
}
},
{
name: 'platform',
in: 'query',
description: '平台(可选)',
schema: {
type: 'string',
enum: ['weibo', 'xiaohongshu', 'douyin', 'bilibili']
}
},
{
name: 'limit',
in: 'query',
description: '返回关键词数量上限',
schema: {
type: 'integer',
default: 20
}
}
],
responses: {
'200': {
description: '成功获取热门关键词',
content: {
'application/json': {
schema: {
type: 'object',
properties: {
success: {
type: 'boolean',
example: true
},
data: {
type: 'array',
items: {
type: 'object',
properties: {
keyword: {
type: 'string',
example: '质量'
},
count: {
type: 'integer',
example: 38
},
percentage: {
type: 'number',
format: 'float',
example: 19.0
},
sentiment_score: {
type: 'number',
format: 'float',
example: 0.7
}
}
}
},
metadata: {
type: 'object',
properties: {
total: {
type: 'integer',
example: 100
},
is_mock_data: {
type: 'boolean',
example: false
}
}
}
}
}
}
}
},
'400': {
description: '请求参数错误',
content: {
'application/json': {
schema: {
type: 'object',
properties: {
success: {
type: 'boolean',
example: false
},
error: {
type: 'string',
example: 'Invalid timeRange. Must be 7, 30, or 90.'
}
}
}
}
}
},
'500': {
description: '服务器错误',
content: {
'application/json': {
schema: {
type: 'object',
properties: {
success: {
type: 'boolean',
example: false
},
error: {
type: 'string',
example: 'Failed to fetch hot keywords data'
}
}
}
}
}
}
}
}
},
},
components: {
schemas: {