ai 试水
This commit is contained in:
parent
4ee38b642f
commit
7b966ac4f2
@ -2,6 +2,7 @@ import tasks.wechat
|
|||||||
import time
|
import time
|
||||||
from .base import *
|
from .base import *
|
||||||
from fastapi import APIRouter
|
from fastapi import APIRouter
|
||||||
|
import requests
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
@ -30,8 +31,52 @@ async def wechat_search_task(item: WechatSearchInput):
|
|||||||
tasks.wechat.click_search_result(d)
|
tasks.wechat.click_search_result(d)
|
||||||
print(tasks.wechat.get_last_friend_text_msg(d))
|
print(tasks.wechat.get_last_friend_text_msg(d))
|
||||||
# tasks.wechat.input_chat_text(d, time.strftime("[AI] %Y-%m-%d %H:%M:%S", time.localtime()))
|
# tasks.wechat.input_chat_text(d, time.strftime("[AI] %Y-%m-%d %H:%M:%S", time.localtime()))
|
||||||
|
|
||||||
|
msg = tasks.wechat.get_last_friend_text_msg(d)
|
||||||
|
msg = msg if msg is not None else ""
|
||||||
|
|
||||||
|
|
||||||
|
# url = "https://api.siliconflow.cn/v1/chat/completions"
|
||||||
|
# payload = {
|
||||||
|
# "model": "Qwen/Qwen2.5-7B-Instruct",
|
||||||
|
# "messages": [
|
||||||
|
# {
|
||||||
|
# "role": "user",
|
||||||
|
# "content": msg
|
||||||
|
# }
|
||||||
|
# ],
|
||||||
|
# "stream": False,
|
||||||
|
# "max_tokens": 512,
|
||||||
|
# "stop": ["null"],
|
||||||
|
# "temperature": 0.7,
|
||||||
|
# "top_p": 0.7,
|
||||||
|
# "top_k": 50,
|
||||||
|
# "frequency_penalty": 0.5,
|
||||||
|
# "n": 1,
|
||||||
|
# "response_format": {"type": "text"},
|
||||||
|
# "tools": [
|
||||||
|
# {
|
||||||
|
# "type": "function",
|
||||||
|
# "function": {
|
||||||
|
# "description": "<string>",
|
||||||
|
# "name": "<string>",
|
||||||
|
# "parameters": {},
|
||||||
|
# "strict": False
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
# ]
|
||||||
|
# }
|
||||||
|
# headers = {
|
||||||
|
# "Authorization": "Bearer {}".format("token"),
|
||||||
|
# "Content-Type": "application/json"
|
||||||
|
# }
|
||||||
|
# response = requests.request("POST", url, json=payload, headers=headers)
|
||||||
|
|
||||||
|
# print(response.text)
|
||||||
|
# tasks.wechat.input_chat_text(d, response.json()["choices"][0]["message"]["content"])
|
||||||
tasks.wechat.input_chat_text(d, item.input_text)
|
tasks.wechat.input_chat_text(d, item.input_text)
|
||||||
|
|
||||||
|
|
||||||
@router.post("/launch")
|
@router.post("/launch")
|
||||||
def wechat_launch(item: Device):
|
def wechat_launch(item: Device):
|
||||||
if item.serial not in devices:
|
if item.serial not in devices:
|
||||||
|
Loading…
Reference in New Issue
Block a user