From a9126f1d126c77550c77ac51aac4864d0452d9d3 Mon Sep 17 00:00:00 2001 From: Vinlic Date: Sun, 16 Jun 2024 19:42:00 +0800 Subject: [PATCH] =?UTF-8?q?login=5Ftongyi=5Fticket=E5=B7=B2=E5=A4=B1?= =?UTF-8?q?=E6=95=88=EF=BC=8C=E6=94=B9=E4=B8=BA=E4=BD=BF=E7=94=A8tongyi=5F?= =?UTF-8?q?sso=5Fticket?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 12 ++++++------ src/api/controllers/chat.ts | 19 +++++++------------ 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 984c5a4..e7ff16a 100644 --- a/README.md +++ b/README.md @@ -100,9 +100,9 @@ https://udify.app/chat/qOXzVl5kkvhQXM8r 从 [通义千问](https://tongyi.aliyun.com/qianwen) 登录 -进入通义千问随便发起一个对话,然后F12打开开发者工具,从Application > Cookies中找到`login_tongyi_ticket`的值,这将作为Authorization的Bearer Token值:`Authorization: Bearer TOKEN` +进入通义千问随便发起一个对话,然后F12打开开发者工具,从Application > Cookies中找到`tongyi_sso_ticket`的值,这将作为Authorization的Bearer Token值:`Authorization: Bearer TOKEN` -![获取login_tongyi_ticket](./doc/example-0.png) +![获取tongyi_sso_ticket](./doc/example-0.png) ### 方法2 @@ -114,7 +114,7 @@ https://udify.app/chat/qOXzVl5kkvhQXM8r ### 多账号接入 -你可以通过提供多个账号的login_tongyi_ticket或login_aliyunid_ticket,并使用,拼接提供: +你可以通过提供多个账号的tongyi_sso_ticket或login_aliyunid_ticket,并使用,拼接提供: Authorization: Bearer TOKEN1,TOKEN2,TOKEN3 @@ -260,7 +260,7 @@ pm2 stop qwen-free-api header 需要设置 Authorization 头部: ``` -Authorization: Bearer [login_tongyi_ticket/login_aliyunid_ticket] +Authorization: Bearer [tongyi_sso_ticket/login_aliyunid_ticket] ``` 请求数据: @@ -317,7 +317,7 @@ Authorization: Bearer [login_tongyi_ticket/login_aliyunid_ticket] header 需要设置 Authorization 头部: ``` -Authorization: Bearer [login_tongyi_ticket/login_aliyunid_ticket] +Authorization: Bearer [tongyi_sso_ticket/login_aliyunid_ticket] ``` 请求数据: @@ -467,7 +467,7 @@ Authorization: Bearer [refresh_token] ### ticket存活检测 -检测login_tongyi_ticket或login_aliyunid_ticket是否存活,如果存活live未true,否则为false,请不要频繁(小于10分钟)调用此接口。 +检测tongyi_sso_ticket或login_aliyunid_ticket是否存活,如果存活live未true,否则为false,请不要频繁(小于10分钟)调用此接口。 **POST /token/check** diff --git a/src/api/controllers/chat.ts b/src/api/controllers/chat.ts index 9f118cb..57410a0 100644 --- a/src/api/controllers/chat.ts +++ b/src/api/controllers/chat.ts @@ -48,7 +48,7 @@ const FILE_MAX_SIZE = 100 * 1024 * 1024; * * 在对话流传输完毕后移除会话,避免创建的会话出现在用户的对话列表中 * - * @param ticket login_tongyi_ticket或login_aliyunid_ticket + * @param ticket tongyi_sso_ticket或login_aliyunid_ticket */ async function removeConversation(convId: string, ticket: string) { const result = await axios.post( @@ -73,7 +73,7 @@ async function removeConversation(convId: string, ticket: string) { * * @param model 模型名称 * @param messages 参考gpt系列消息格式,多轮对话请完整提供上下文 - * @param ticket login_tongyi_ticket或login_aliyunid_ticket + * @param ticket tongyi_sso_ticket或login_aliyunid_ticket * @param refConvId 引用的会话ID * @param retryCount 重试次数 */ @@ -166,7 +166,7 @@ async function createCompletion( * * @param model 模型名称 * @param messages 参考gpt系列消息格式,多轮对话请完整提供上下文 - * @param ticket login_tongyi_ticket或login_aliyunid_ticket + * @param ticket tongyi_sso_ticket或login_aliyunid_ticket * @param refConvId 引用的会话ID * @param retryCount 重试次数 */ @@ -689,7 +689,7 @@ async function receiveImages( /** * 获取上传参数 * - * @param ticket login_tongyi_ticket或login_aliyunid_ticket + * @param ticket tongyi_sso_ticket或login_aliyunid_ticket */ async function acquireUploadParams(ticket: string) { const result = await axios.post( @@ -739,7 +739,7 @@ async function checkFileUrl(fileUrl: string) { * 上传文件 * * @param fileUrl 文件URL - * @param ticket login_tongyi_ticket或login_aliyunid_ticket + * @param ticket tongyi_sso_ticket或login_aliyunid_ticket */ async function uploadFile(fileUrl: string, ticket: string) { // 预检查远程文件URL可用性 @@ -909,19 +909,14 @@ function tokenSplit(authorization: string) { /** * 生成Cookies * - * @param ticket login_tongyi_ticket或login_aliyunid_ticket + * @param ticket tongyi_sso_ticket或login_aliyunid_ticket */ function generateCookie(ticket: string) { return [ - `${ticket.length > 100 ? 'login_aliyunid_ticket' : 'login_tongyi_ticket'}=${ticket}`, + `${ticket.length > 100 ? 'login_aliyunid_ticket' : 'tongyi_sso_ticket'}=${ticket}`, 'aliyun_choice=intl', "_samesite_flag_=true", `t=${util.uuid(false)}`, - "channel=oug71n2fX3Jd5ualEfKACRvnsceUtpjUC5jHBpfWnSOXKhkvBNuSO8bG3v4HHjCgB722h7LqbHkB6sAxf3OvgA%3D%3D", - "currentRegionId=cn-shenzhen", - "aliyun_country=CN", - "aliyun_lang=zh", - "aliyun_site=CN", // `login_aliyunid_csrf=_csrf_tk_${util.generateRandomString({ charset: 'numeric', length: 15 })}`, // `cookie2=${util.uuid(false)}`, // `munb=22${util.generateRandomString({ charset: 'numeric', length: 11 })}`,