Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
allrobot opened this issue Jun 12, 2024 · 1 comment
Closed

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

allrobot opened this issue Jun 12, 2024 · 1 comment

Comments

@allrobot
Copy link

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
Copy link
Member

Vinlic commented Jun 15, 2024

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

@Vinlic Vinlic closed this as completed Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants