admin管理员组文章数量:1122846
I am having Issues with my home assistant webhook that sends the Alexa json to ChatGPT. I have created a custom Alexa Skill with one intent and a few utterances to "prompt". My home assistant webhook automation looks like this:
automation:
- alias: ChatGPT Webhook Dynamic Handler
trigger:
platform: webhook
webhook_id: chatgpt_webhook
action:
# Step 1: Check if the payload contains a 'prompt'
- choose:
- conditions:
- "{{ 'prompt' in trigger.data }}"
sequence:
# Step 2: Send the 'prompt' to the OpenAI API using the REST command
- service: rest_command.openai_query
data:
prompt: "{{ trigger.data['prompt'] }}"
# Step 3: Wait for the response from OpenAI
- wait_template: "{{ states('input_text.chatgpt_response') != 'Awaiting response...' }}"
timeout: "00:00:10"
continue_on_timeout: false
# Step 4: Save the response for reference
- service: input_text.set_value
data:
entity_id: input_text.chatgpt_response
value: "{{ states('input_text.chatgpt_response') }}"
# Step 5: Notify the response using TTS
- service: notify.media_player.office_echo
data:
type: tts
message: "ChatGPT Response: {{ states('input_text.chatgpt_response') }}"
title: "Webhook Response"
# Step 6: Notify the response for debugging
- service: persistent_notification.create
data:
message: "ChatGPT Response: {{ states('input_text.chatgpt_response') }}"
title: "Webhook Response"
# Default action if 'prompt' is not in the payload
default:
- service: persistent_notification.create
data:
message: "Webhook triggered, but no 'prompt' found in data!"
title: "Webhook Debug"
Im wondering if someone out there can point out whats wrong in the code?
I have spent countless hours formatting and trying different variations of the base code, but i'm having trouble getting it to work.
本文标签: ChatGptHome AssistantAlexa IntegrationStack Overflow
版权声明:本文标题:ChatGPT, Home Assistant, Alexa Integration - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736187619a1909155.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论