Skip to content

Commit 8f0b21a

Browse files
authored
Merge pull request #16 from wsrh8888/feature-rh
Feature rh
2 parents 8392891 + 2cd4512 commit 8f0b21a

File tree

163 files changed

+9047
-1802
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+9047
-1802
lines changed

.cursor/rules/rule.mdc

Lines changed: 60 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,68 @@ alwaysApply: true
66
这是一个开源的IM(即时通讯)项目,对标大厂和开源IM产品。
77

88
### 技术架构
9-
vite+ eluniappectron+vue3
9+
vite + electron + vue3
1010

11-
### ts别名
11+
### 文件命名规范
12+
- 所有文件(包括组件)不能以大写字母开头,如果是多个单词采用驼峰命名(kebab-case 或 lowCamelCase,根据项目习惯,此处恢复为您要求的规范)。
13+
- 如果文件夹名已包含了某个功能前缀(如 `user`),则子文件不再重复该前缀。
1214

13-
### 文件命名
14-
- 所有的文件不能以大写字母开头, 如果是多个单词采用驼峰命名
15-
- 文件名字如果我文件夹已经携带了xx, 这个子文件就不要在携带xxx开头的了
15+
### CSS 编写
16+
- 使用 Less,采用嵌套结构开发。
1617

17-
### css的编写
18-
- 我使用scss, 你的css开发的时候采用嵌套结构
18+
### Pinia 规范
19+
- 参考模版(替换 `xx` 为模块名):
20+
```typescript
21+
import { defineStore } from 'pinia'
1922

23+
export const usexxStore = defineStore('usexxStore', {
24+
state: () => ({
25+
}),
26+
getters: {
27+
},
28+
actions: {
29+
},
30+
})
31+
```
32+
33+
### 文件与路径
34+
- 不要编写 .md 文档。
35+
- 尽可能使用别名(如 `@/`),严禁使用 `../` 之类的相对路径。
36+
37+
### .vue 文件编写规范
38+
- 严禁使用 `<script lang="ts" setup>`,必须采用 `export default defineComponent` 结构。
39+
- 标签顺序:`<template>` -> `<script>` -> `<style>`。
40+
- 严禁直接使用 `<svg>` 标签,必须使用 `<img>` 标签引入 SVG 文件路径。
41+
42+
### 资源管理
43+
- 严禁使用文本表情包(如 📞、✓),统一使用 SVG 文件。
44+
- SVG 存放路径:`src/render/assets/images/[module]/[name].svg`。
45+
- SVG 素材由 AI(我)负责生成/编写。
46+
47+
### 接口规范
48+
- 数据结构统一为:
49+
```typescript
50+
{
51+
code: number,
52+
msg: string,
53+
result: any
54+
}
55+
```
56+
- 接口类型以 `I` 开头,以 `Req` 或 `Res` 结尾。
57+
- 接口方法名必须包含 `Api` 后缀。
58+
- 严禁使用 `import * as xxxApi` 语法。
59+
- 由于底层已统一处理异常,业务代码中严禁写 `try...catch`,直接根据 `code === 0` 判断成功,非 0 则使用 `msg`。
60+
61+
### 文件引入
62+
- 拒绝使用@/相关的
63+
- 必须使用相对路径或者下面的路径
64+
```typescript
65+
commonModule: path.resolve(__dirname, 'src/common'),
66+
mainModule: path.resolve(__dirname, 'src/main'),
67+
renderModule: path.resolve(__dirname, 'src/render'),
68+
preloadModule: path.resolve(__dirname, 'src/preload'),
69+
```
2070
### 切记
21-
- 不要过度开发
22-
- 不要写md文件
23-
- 尽可能使用别名不要使用../之类的相对路径
71+
- 拒绝过度开发,保持代码精简。
72+
- 严格遵循路径别名和文件命名。
73+

ai.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="zh-CN">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>AI助手 - 海狸IM</title>
7+
</head>
8+
<body>
9+
<div id="app"></div>
10+
<script type="module" src="/src/render/windows/ai/main.ts"></script>
11+
</body>
12+
</html>

call-incoming.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<html lang="zh-CN">
3+
4+
<head>
5+
<meta charset="UTF-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>来电提示</title>
8+
</head>
9+
10+
<body>
11+
<div id="app"></div>
12+
<script type="module" src="/src/render/windows/call-incoming/main.ts"></script>
13+
</body>
14+
15+
</html>

call.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="zh-CN">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Beaver Call</title>
7+
</head>
8+
<body>
9+
<div id="app"></div>
10+
<script type="module" src="/src/render/windows/call/main.ts"></script>
11+
</body>
12+
</html>

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "beaver",
33
"type": "module",
4-
"version": "1.1.1",
4+
"version": "1.2.0",
55
"private": true,
66
"description": "beaverIM",
77
"author": "Robert",
@@ -74,7 +74,6 @@
7474
"@types/better-sqlite3": "^7.6.13",
7575
"@types/uuid": "^10.0.0",
7676
"@types/ws": "^8.18.1",
77-
"axios-retry": "^4.5.0",
7877
"better-sqlite3": "^12.4.1",
7978
"browser-md5-file": "^1.1.1",
8079
"cors": "^2.8.5",
@@ -85,6 +84,7 @@
8584
"electron-updater": "^6.3.9",
8685
"express": "^5.2.1",
8786
"extract-zip": "^2.0.1",
87+
"livekit-client": "^2.17.1",
8888
"node-machine-id": "^1.1.12",
8989
"sql.js": "^1.13.0",
9090
"uuid": "^11.1.0",
@@ -142,4 +142,4 @@
142142
"eslint --fix"
143143
]
144144
}
145-
}
145+
}

src/common/type/ajax/call.ts

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
export interface IParticipant {
2+
userId: string
3+
status: 'calling' | 'joined' | 'left' | 'rejected' | 'busy'
4+
}
5+
6+
// 发起音视频通话请求
7+
export interface IStartCallReq {
8+
callType: number // 通话类型:1-私聊, 2-群聊
9+
callMode: number // 1-语音, 2-视频
10+
conversationId: string // 会话ID:带前缀的完整格式
11+
}
12+
13+
// 发起音视频通话响应
14+
export interface IStartCallRes {
15+
roomId: string // 房间ID
16+
roomToken: string // LiveKit令牌
17+
liveKitUrl: string // LiveKit服务器地址
18+
participants: IParticipant[] // 初始参与者快照
19+
}
20+
21+
// 获取通话令牌请求
22+
export interface IGetCallTokenReq {
23+
roomId: string
24+
}
25+
26+
// 获取通话令牌响应
27+
export interface IGetCallTokenRes {
28+
roomToken: string
29+
liveKitUrl: string
30+
participants: IParticipant[] // 当前所有成员快照
31+
}
32+
33+
// 挂断/拒绝通话请求
34+
export interface IHangupCallReq {
35+
roomId: string
36+
}
37+
38+
// 挂断/拒绝通话响应
39+
export interface IHangupCallRes { }
40+
41+
// 新增成员请求
42+
export interface IAddCallMemberReq {
43+
roomId: string
44+
}
45+
46+
// 新增成员响应
47+
export interface IAddCallMemberRes {
48+
roomToken: string
49+
liveKitUrl: string
50+
}
51+
52+
// 获取房间成员清单请求
53+
export interface IGetCallParticipantsReq {
54+
roomId: string
55+
}
56+
57+
// 获取房间成员清单响应
58+
export interface IGetCallParticipantsRes {
59+
participants: IParticipant[]
60+
}
61+
62+
export interface IInviteCallMemberReq {
63+
roomId: string;
64+
targetIds: string[];
65+
}
66+
67+
export interface IInviteCallMemberRes { }
68+
69+
// 通话历史记录请求
70+
export interface IGetCallHistoryReq {
71+
page?: number
72+
size?: number
73+
}
74+
75+
// 通话历史记录项
76+
export interface ICallHistoryItem {
77+
roomId: string
78+
callerId: string
79+
callType: number
80+
status: number
81+
startTime: number
82+
duration: number
83+
}
84+
85+
// 通话历史记录响应
86+
export interface IGetCallHistoryRes {
87+
list: ICallHistoryItem[]
88+
}

0 commit comments

Comments
 (0)