feat: sync Sidebar and BottomNav, standardize user profile API

Align Sidebar & BottomNav menus, remove "Search", add user profile mock data, implement /api/users, add FilterDrawer, complete Section, ProfileHeader, MetricsRFM components

Co-authored-by: null <4804959+fnvtk@users.noreply.github.com>
This commit is contained in:
v0
2025-08-08 07:00:12 +00:00
parent 4eed69520c
commit f0a6a364f2
85 changed files with 3318 additions and 6786 deletions

View File

@@ -224,7 +224,6 @@ export class IntelligentSearchService {
// 生成补全建议
private async generateCompletionSuggestions(query: string): Promise<string[]> {
// 这里可以集成更复杂的自动补全逻辑
const commonSuffixes = ["分析", "统计", "趋势", "预测", "报告", "用户", "流量", "关键词", "转化", "留存"]
return commonSuffixes
@@ -236,12 +235,10 @@ export class IntelligentSearchService {
// 解析AI建议
private parseAISuggestions(aiResult: any): string[] {
try {
// 假设AI返回的是建议列表
if (aiResult.suggestions && Array.isArray(aiResult.suggestions)) {
return aiResult.suggestions
}
// 如果是文本格式,尝试解析
if (typeof aiResult === "string") {
const lines = aiResult.split("\n")
return lines
@@ -266,7 +263,6 @@ export class IntelligentSearchService {
Object.assign(filters, aiAnalysis.filters)
}
// 基于AI分析结果添加智能过滤器
if (aiAnalysis.intent === "high_value_users") {
filters.rfm_score = { $gte: 80 }
}
@@ -286,14 +282,12 @@ export class IntelligentSearchService {
const insights: SearchResult[] = []
try {
// 用户相关洞察
const userResults = results.filter((r) => r.type === "user")
if (userResults.length > 0) {
const userInsight = await this.generateUserInsight(query, userResults)
if (userInsight) insights.push(userInsight)
}
// 流量相关洞察
const trafficResults = results.filter((r) => r.type === "traffic")
if (trafficResults.length > 0) {
const trafficInsight = await this.generateTrafficInsight(query, trafficResults)
@@ -414,17 +408,15 @@ export class IntelligentSearchService {
private extractAvailableFilters(results: SearchResult[]): Record<string, any> {
const filters: Record<string, any> = {}
// 提取类型过滤器
const types = [...new Set(results.map((r) => r.type))]
if (types.length > 1) {
filters.type = types
}
// 提取标签过滤器
const allTags = results.flatMap((r) => r.tags)
const uniqueTags = [...new Set(allTags)]
if (uniqueTags.length > 0) {
filters.tags = uniqueTags.slice(0, 20) // 限制标签数量
filters.tags = uniqueTags.slice(0, 20)
}
return filters
@@ -434,11 +426,9 @@ export class IntelligentSearchService {
private addToSearchHistory(query: string): void {
if (query.trim().length === 0) return
// 更新搜索历史
this.searchHistory.unshift(query)
this.searchHistory = [...new Set(this.searchHistory)].slice(0, 100) // 保留最近100个唯一查询
this.searchHistory = [...new Set(this.searchHistory)].slice(0, 100)
// 更新热门查询统计
const count = this.popularQueries.get(query) || 0
this.popularQueries.set(query, count + 1)
}