LLM-Red-Team / qwen-free-api

🚀 阿里通义千问2.5大模型逆向API白嫖测试【特长:六边形战士】,支持高速流式输出、无水印AI绘图、长文档解读、图像解析、多轮对话,零配置部署,多路token支持,自动清理会话痕迹。
https://udify.app/chat/qOXzVl5kkvhQXM8r
GNU General Public License v3.0
552 stars 154 forks source link

使用login_tongyi_ticket后网页就要求重新登录 #38

Closed allrobot closed 3 months ago

allrobot commented 3 months ago
import pyperclip
import requests, json, sys

qwen_ticket = 'login_tongyi_ticket。。。。'
third_party_url = 'http://localhost:8001/v1/chat/completions'
headers = {
    'Authorization': f'Bearer {qwen_ticket}',
    'Content-Type': 'application/json'
}

def get_translation(content_text):
    prompt_text = {
        'model': 'qwen2',
        'messages': [
            {
  'role': 'user',
  'content': content_text
            }
        ],
        'stream': False
    }
    response = requests.post(third_party_url, headers=headers, json=prompt_text)

    if response.status_code == 200:
        response_data = json.loads(response.text)
        try:
            print(response_data["choices"][0]["message"]['content'])
        except:
            print(f'请求失败\n{response.text}')
    else:
        print(f'请求失败\n{response.text}')

clipboard_string = pyperclip.paste()
if isinstance(clipboard_string, str):
    sys.stdout.reconfigure(encoding='utf-8')
    get_translation(clipboard_string)
    # for chunk in response:
    #     print(chunk.choices[0].delta)

发送一次数据后,PC网页版就要求重新登录了……

另外,如何给通义的智能体发送数据?智谱能指定ai模型,qwen的智能体网页链接后缀是A-69933-09d224e0,ai指定了好像没啥用

Vinlic commented 3 months ago

登录态可能只能在一个设备上可用,智能体目前还未做支持