Closed allrobot closed 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指定了好像没啥用
登录态可能只能在一个设备上可用,智能体目前还未做支持
发送一次数据后,PC网页版就要求重新登录了……
另外,如何给通义的智能体发送数据?智谱能指定ai模型,qwen的智能体网页链接后缀是A-69933-09d224e0,ai指定了好像没啥用