8000 🐛 fix: Fix heatmap and manifest (#5289) · lobehub/lobe-chat@3973249 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit 3973249

Browse files
🐛 fix: Fix heatmap and manifest (#5289)
* 🐛 fix: Fix heatmap and manifest * 📝 docs: Update changelog * ✅ test: Fix test * ✅ test: Fix test * ✅ test: Fix test
1 parent 0280c1d commit 3973249

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

docs/changelog/index.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
"$schema": "https://github.com/lobehub/lobe-chat/blob/main/docs/changelog/schema.json",
33
"cloud": [],
44
"community": [
5+
{
6+
"image": "https://github.com/user-attachments/assets/3d80e0f5-d32a-4412-85b2-e709731460a0",
7+
"id": "2025-01-03-user-profile",
8+
"date": "2025-01-03",
9+
"versionRange": ["1.43.0", "1.43.1"]
10+
},
511
{
612
"image": "https://github.com/user-attachments/assets/2048b4c2-4a56-4029-acf9-71e35ff08652",
713
"id": "2024-11-27-forkable-chat",

src/app/manifest.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@ import type { MetadataRoute } from 'next';
33

44
import { BRANDING_LOGO_URL, BRANDING_NAME } from '@/const/branding';
55
import { manifestModule } from '@/server/manifest';
6-
import { translation } from '@/server/translation';
7-
8-
const manifest = async (): Promise<MetadataRoute.Manifest | any> => {
9-
const { t } = await translation('metadata');
106

7+
const manifest = (): MetadataRoute.Manifest | any => {
118
return manifestModule.generate({
12-
description: t('chat.description', { appName: BRANDING_NAME }),
9+
description: `${BRANDING_NAME} brings you the best UI experience for ChatGPT, Claude, Gemini, and OLLaMA.`,
1310
icons: [
1411
{
1512
purpose: 'any',

src/database/server/models/__tests__/message.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,14 +1278,14 @@ describe('MessageModel', () => {
12781278
(item) => item.date === today.subtract(2, 'day').format('YYYY-MM-DD'),
12791279
);
12801280
expect(twoDaysAgo?.count).toBe(2);
1281-
expect(twoDaysAgo?.level).toBe(0);
1281+
expect(twoDaysAgo?.level).toBe(1);
12821282

12831283
// 检查一天前的数据
12841284
const oneDayAgo = result.find(
12851285
(item) => item.date === today.subtract(1, 'day').format('YYYY-MM-DD'),
12861286
);
12871287
expect(oneDayAgo?.count).toBe(1);
1288-
expect(oneDayAgo?.level).toBe(0);
1288+
expect(oneDayAgo?.level).toBe(1);
12891289

12901290
// 检查今天的数据
12911291
const todayData = result.find((item) => item.date === today.format('YYYY-MM-DD'));
@@ -1356,25 +1356,25 @@ describe('MessageModel', () => {
13561356
(item) => item.date === today.subtract(4, 'day').format('YYYY-MM-DD'),
13571357
);
13581358
expect(fourDaysAgo?.count).toBe(1);
1359-
expect(fourDaysAgo?.level).toBe(0);
1359+
expect(fourDaysAgo?.level).toBe(1);
13601360

13611361
const threeDaysAgo = result.find(
13621362
(item) => item.date === today.subtract(3, 'day').format('YYYY-MM-DD'),
13631363
);
13641364
expect(threeDaysAgo?.count).toBe(6);
1365-
expect(threeDaysAgo?.level).toBe(1);
1365+
expect(threeDaysAgo?.level).toBe(2);
13661366

13671367
const twoDaysAgo = result.find(
13681368
(item) => item.date === today.subtract(2, 'day').format('YYYY-MM-DD'),
13691369
);
13701370
expect(twoDaysAgo?.count).toBe(11);
1371-
expect(twoDaysAgo?.level).toBe(2);
1371+
expect(twoDaysAgo?.level).toBe(3);
13721372

13731373
const oneDayAgo = result.find(
13741374
(item) => item.date === today.subtract(1, 'day').format('YYYY-MM-DD'),
13751375
);
13761376
expect(oneDayAgo?.count).toBe(16);
1377-
expect(oneDayAgo?.level).toBe(3);
1377+
expect(oneDayAgo?.level).toBe(4);
13781378

13791379
const todayData = result.find((item) => item.date === today.format('YYYY-MM-DD'));
13801380
expect(todayData?.count).toBe(21);

src/database/server/models/message.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ export class MessageModel {
378378
);
379379

380380
const count = matchingResult ? matchingResult.count : 0;
381-
const levelCount = count > 0 ? Math.floor(count / 5) : 0;
381+
const levelCount = count > 0 ? Math.ceil(count / 5) : 0;
382382
const level = levelCount > 4 ? 4 : levelCount;
383383

384384
heatmapData.push({

0 commit comments

Comments
 (0)
0