login_tongyi_ticket已失效,改为使用tongyi_sso_ticket

This commit is contained in:
Vinlic 2024-06-16 19:42:00 +08:00
parent f727286a33
commit a9126f1d12
2 changed files with 13 additions and 18 deletions

View File

@ -100,9 +100,9 @@ https://udify.app/chat/qOXzVl5kkvhQXM8r
从 [通义千问](https://tongyi.aliyun.com/qianwen) 登录 从 [通义千问](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 ### 方法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 Authorization: Bearer TOKEN1,TOKEN2,TOKEN3
@ -260,7 +260,7 @@ pm2 stop qwen-free-api
header 需要设置 Authorization 头部: 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 头部: 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存活检测 ### ticket存活检测
检测login_tongyi_ticket或login_aliyunid_ticket是否存活如果存活live未true否则为false请不要频繁小于10分钟调用此接口。 检测tongyi_sso_ticket或login_aliyunid_ticket是否存活如果存活live未true否则为false请不要频繁小于10分钟调用此接口。
**POST /token/check** **POST /token/check**

View File

@ -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) { async function removeConversation(convId: string, ticket: string) {
const result = await axios.post( const result = await axios.post(
@ -73,7 +73,7 @@ async function removeConversation(convId: string, ticket: string) {
* *
* @param model * @param model
* @param messages gpt系列消息格式 * @param messages gpt系列消息格式
* @param ticket login_tongyi_ticket或login_aliyunid_ticket * @param ticket tongyi_sso_ticket或login_aliyunid_ticket
* @param refConvId ID * @param refConvId ID
* @param retryCount * @param retryCount
*/ */
@ -166,7 +166,7 @@ async function createCompletion(
* *
* @param model * @param model
* @param messages gpt系列消息格式 * @param messages gpt系列消息格式
* @param ticket login_tongyi_ticket或login_aliyunid_ticket * @param ticket tongyi_sso_ticket或login_aliyunid_ticket
* @param refConvId ID * @param refConvId ID
* @param retryCount * @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) { async function acquireUploadParams(ticket: string) {
const result = await axios.post( const result = await axios.post(
@ -739,7 +739,7 @@ async function checkFileUrl(fileUrl: string) {
* *
* *
* @param fileUrl URL * @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) { async function uploadFile(fileUrl: string, ticket: string) {
// 预检查远程文件URL可用性 // 预检查远程文件URL可用性
@ -909,19 +909,14 @@ function tokenSplit(authorization: string) {
/** /**
* Cookies * Cookies
* *
* @param ticket login_tongyi_ticket或login_aliyunid_ticket * @param ticket tongyi_sso_ticket或login_aliyunid_ticket
*/ */
function generateCookie(ticket: string) { function generateCookie(ticket: string) {
return [ return [
`${ticket.length > 100 ? 'login_aliyunid_ticket' : 'login_tongyi_ticket'}=${ticket}`, `${ticket.length > 100 ? 'login_aliyunid_ticket' : 'tongyi_sso_ticket'}=${ticket}`,
'aliyun_choice=intl', 'aliyun_choice=intl',
"_samesite_flag_=true", "_samesite_flag_=true",
`t=${util.uuid(false)}`, `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 })}`, // `login_aliyunid_csrf=_csrf_tk_${util.generateRandomString({ charset: 'numeric', length: 15 })}`,
// `cookie2=${util.uuid(false)}`, // `cookie2=${util.uuid(false)}`,
// `munb=22${util.generateRandomString({ charset: 'numeric', length: 11 })}`, // `munb=22${util.generateRandomString({ charset: 'numeric', length: 11 })}`,