我在部署公共google home ski时遇到问题

2024-05-18 23:31:59 发布

您现在位置:Python中文网/ 问答频道 /正文

当我部署google home skill时,出现的问题是-

您的操作可能会让麦克风在没有提示(如问候语)的情况下对用户命令保持打开状态,也可能会让麦克风出现隐式或显式问题

url = "https://hrm-api.herokuapp.com"

def lambda_handler(event, context):

  print("this is event = "+str(event))
  nm = json.loads(event['body'])
  nmm = nm['queryResult']['parameters']['any']
  #nmm = nmm[0]
  print(nmm,"hiiiii")
  payload = {
        "query":nmm
        }

  headers = {'x-ucontext-token': '23223'}
  r = requests.post(url,headers=headers,data=payload)
  astt = str((r.json())['userMessage'])

  astt = astt.replace("<br>","\n")
  astt = astt.replace("</b>","")
  astt = astt.replace("<b>","")

  a = {
       "payload": {
         "google": {
           "expectUserResponse": True,
           "richResponse": {
             "items": [
               {
                 "simpleResponse": {
                   "textToSpeech": astt
                 }
               }
             ]
           }




Tags: eventjsonurlhome部署googlereplaceskill

热门问题