Skip to content

Commit 78ff5d9

Browse files
committed
Fix baichuan
1 parent f7e7820 commit 78ff5d9

3 files changed

Lines changed: 31 additions & 0 deletions

File tree

manifest.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ export default defineManifest(async (env) => {
6767
enabled: true,
6868
path: 'src/rules/qianwen.json',
6969
},
70+
{
71+
id: 'ruleset_baichuan',
72+
enabled: true,
73+
path: 'src/rules/baichuan.json',
74+
},
7075
],
7176
},
7277
}

src/app/bots/baichuan/api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ interface UserInfo {
99
export async function getUserInfo(): Promise<UserInfo> {
1010
const resp = await ofetch<{ data?: UserInfo; code: number; msg: string }>(
1111
'https://www.baichuan-ai.com/api/user/user-info',
12+
{ method: 'POST' },
1213
)
1314
if (resp.code === 401) {
1415
throw new ChatError('请先登录百川账号', ErrorCode.BAICHUAN_WEB_UNAUTHORIZED)

src/rules/baichuan.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[
2+
{
3+
"id": 1,
4+
"priority": 1,
5+
"action": {
6+
"type": "modifyHeaders",
7+
"requestHeaders": [
8+
{
9+
"header": "origin",
10+
"operation": "set",
11+
"value": "https://www.baichuan-ai.com"
12+
},
13+
{
14+
"header": "referer",
15+
"operation": "set",
16+
"value": "https://www.baichuan-ai.com"
17+
}
18+
]
19+
},
20+
"condition": {
21+
"requestDomains": ["www.baichuan-ai.com"],
22+
"resourceTypes": ["xmlhttprequest"]
23+
}
24+
}
25+
]

0 commit comments

Comments
 (0)