如何刷新 VS Code 中 Prisma 更新的表和字段

背景

当我更新 Prisma Schema 的时候,有时会出现即使通过 prisma db pushprisma generate 更新了数据库,也显示成功,但在 VS Code 中依然无法通过代码自动完成看到更新的字段,比较困扰,有时重新打开 VS Code 会好,有时不会

解决方案

原因主要是 VS Code 的缓存没有及时更新,查询后发现一个立即更新缓存的方法,就是在 VS Code 中,找到 node_modules/.prisma/client/index.d.ts ,并打开,这时 VS Code 就会自动更新缓存。我测试了一下有效,大家可以试试。

More...

PostgreSQL 带向量数据库的安装

背景

做 AI 相关项目需要用到向量数据库,本来想直接使用 PostgreSQL ,结果发现默认的安装是没有安装向量数据库的,打算重新安装一个带向量支持的。

实现步骤如下:

Create Volume

创建一个相关的卷用于保存数据

1
docker volume create --driver local --opt device=C:\10.VM\data\pg02 --opt type=none --opt o=bind pg02

拉取相关 Docker 镜像

下面这个镜像是包含向量数据库的:

1
docker pull ankane/pgvector:latest

启动 docker

1
docker run --name pgvector --privileged -e POSTGRES_PASSWORD=pGp@ssw0rd -p 15678:5432 -v pg02:/var/lib/postgresql/data -d ankane/pgvector:latest
More...

从零搭建基于 AI GitHub 分析平台 (12) 批量生成总结并存储数据库

调整数据库,添加相关表

修改 prisma/schema.prisma:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
model Project {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
name String
githubURL String
deleteAt DateTime?
usersProject UsersProject[]
commits Commit[]
}

model Commit {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt

projectId String
project Project @relation(fields: [projectId], references: [id])

commitMessage String
commitHash String
commitAuthorName String
commitAuthorAvatar String
commitDate DateTime
// ai summary
summary String
}
More...

从零搭建基于 AI GitHub 分析平台 (11) 基于commit diff 生成 commit 的总结

效果:

执行语句 bun run src/lib/gpt.ts :

1
2
3
4
5
6
7
8
- Set `randomOption` default value to `1` in the examination page.
- Add `zod` schema validation and new hooks for exam records and questions.
- Replace `useStartWCDialog` with `useExamDialog` for handling exam dialogs.
- Add logic to handle wrong question collections and create new exam records.
- Include `questionNum` in the API response for questions of a repository.
- Replace `thumbUrl` with `isWrongCollection` in the repositories API response.
- Reorganize imports and adjust button layout in the new exam dialog component.
- Filter repositories to hide items with `isWrongCollection` set to `1`.

我拿了一个比较复杂的代码提交,总结的比较到位。

More...

请我喝杯咖啡吧~

支付宝
微信