mirror of
https://github.com/lobehub/lobe-chat.git
synced 2026-06-16 20:46:08 +00:00
🐛 fix: Fix heatmap and manifest (#5289)
* 🐛 fix: Fix heatmap and manifest * 📝 docs: Update changelog * ✅ test: Fix test * ✅ test: Fix test * ✅ test: Fix test
This commit is contained in:
@@ -2,6 +2,12 @@
|
||||
"$schema": "https://github.com/lobehub/lobe-chat/blob/main/docs/changelog/schema.json",
|
||||
"cloud": [],
|
||||
"community": [
|
||||
{
|
||||
"image": "https://github.com/user-attachments/assets/3d80e0f5-d32a-4412-85b2-e709731460a0",
|
||||
"id": "2025-01-03-user-profile",
|
||||
"date": "2025-01-03",
|
||||
"versionRange": ["1.43.0", "1.43.1"]
|
||||
},
|
||||
{
|
||||
"image": "https://github.com/user-attachments/assets/2048b4c2-4a56-4029-acf9-71e35ff08652",
|
||||
"id": "2024-11-27-forkable-chat",
|
||||
|
||||
+2
-5
@@ -3,13 +3,10 @@ import type { MetadataRoute } from 'next';
|
||||
|
||||
import { BRANDING_LOGO_URL, BRANDING_NAME } from '@/const/branding';
|
||||
import { manifestModule } from '@/server/manifest';
|
||||
import { translation } from '@/server/translation';
|
||||
|
||||
const manifest = async (): Promise<MetadataRoute.Manifest | any> => {
|
||||
const { t } = await translation('metadata');
|
||||
|
||||
const manifest = (): MetadataRoute.Manifest | any => {
|
||||
return manifestModule.generate({
|
||||
description: t('chat.description', { appName: BRANDING_NAME }),
|
||||
description: `${BRANDING_NAME} brings you the best UI experience for ChatGPT, Claude, Gemini, and OLLaMA.`,
|
||||
icons: [
|
||||
{
|
||||
purpose: 'any',
|
||||
|
||||
@@ -1278,14 +1278,14 @@ describe('MessageModel', () => {
|
||||
(item) => item.date === today.subtract(2, 'day').format('YYYY-MM-DD'),
|
||||
);
|
||||
expect(twoDaysAgo?.count).toBe(2);
|
||||
expect(twoDaysAgo?.level).toBe(0);
|
||||
expect(twoDaysAgo?.level).toBe(1);
|
||||
|
||||
// 检查一天前的数据
|
||||
const oneDayAgo = result.find(
|
||||
(item) => item.date === today.subtract(1, 'day').format('YYYY-MM-DD'),
|
||||
);
|
||||
expect(oneDayAgo?.count).toBe(1);
|
||||
expect(oneDayAgo?.level).toBe(0);
|
||||
expect(oneDayAgo?.level).toBe(1);
|
||||
|
||||
// 检查今天的数据
|
||||
const todayData = result.find((item) => item.date === today.format('YYYY-MM-DD'));
|
||||
@@ -1356,25 +1356,25 @@ describe('MessageModel', () => {
|
||||
(item) => item.date === today.subtract(4, 'day').format('YYYY-MM-DD'),
|
||||
);
|
||||
expect(fourDaysAgo?.count).toBe(1);
|
||||
expect(fourDaysAgo?.level).toBe(0);
|
||||
expect(fourDaysAgo?.level).toBe(1);
|
||||
|
||||
const threeDaysAgo = result.find(
|
||||
(item) => item.date === today.subtract(3, 'day').format('YYYY-MM-DD'),
|
||||
);
|
||||
expect(threeDaysAgo?.count).toBe(6);
|
||||
expect(threeDaysAgo?.level).toBe(1);
|
||||
expect(threeDaysAgo?.level).toBe(2);
|
||||
|
||||
const twoDaysAgo = result.find(
|
||||
(item) => item.date === today.subtract(2, 'day').format('YYYY-MM-DD'),
|
||||
);
|
||||
expect(twoDaysAgo?.count).toBe(11);
|
||||
expect(twoDaysAgo?.level).toBe(2);
|
||||
expect(twoDaysAgo?.level).toBe(3);
|
||||
|
||||
const oneDayAgo = result.find(
|
||||
(item) => item.date === today.subtract(1, 'day').format('YYYY-MM-DD'),
|
||||
);
|
||||
expect(oneDayAgo?.count).toBe(16);
|
||||
expect(oneDayAgo?.level).toBe(3);
|
||||
expect(oneDayAgo?.level).toBe(4);
|
||||
|
||||
const todayData = result.find((item) => item.date === today.format('YYYY-MM-DD'));
|
||||
expect(todayData?.count).toBe(21);
|
||||
|
||||
@@ -378,7 +378,7 @@ export class MessageModel {
|
||||
);
|
||||
|
||||
const count = matchingResult ? matchingResult.count : 0;
|
||||
const levelCount = count > 0 ? Math.floor(count / 5) : 0;
|
||||
const levelCount = count > 0 ? Math.ceil(count / 5) : 0;
|
||||
const level = levelCount > 4 ? 4 : levelCount;
|
||||
|
||||
heatmapData.push({
|
||||
|
||||
Reference in New Issue
Block a user