Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias: Set Input Text with ChatGPT
- sequence:
- - data:
- prompt: "{{ prompt }}"
- language: "{{ language }}"
- instruction: "{{ instruction }}"
- model: "{{ model }}"
- response_variable: chatGptResponse
- action: script.get_chatgpt_response
- - if:
- - condition: template
- value_template: "{{ chatGptResponse.success != true }}"
- then:
- - metadata: {}
- data:
- service:
- - Home Assistant
- message: Failed to get valid ChatGPT response!
- title: Set ChatGPT Script
- action: script.notify_self
- - stop: Invalid ChatGPT response
- error: true
- - variables:
- message: >
- {% set msg = chatGptResponse.message %} {% if
- remove_first_and_last_quotes == true %}
- {% if msg[:1] == '"' %}
- {% set msg = msg[1:] %}
- {% endif %}
- {% if msg[-1:] == '"' %}
- {% set msg = msg[:-1] %}
- {% endif %}
- {% endif %} {{ msg }}
- - data:
- value: "{{ message }}"
- target:
- entity_id: "{{ input_text }}"
- action: input_text.set_value
- fields:
- prompt:
- selector:
- text: null
- name: Prompt
- required: true
- language:
- selector:
- select:
- options:
- - nl
- name: Language
- required: true
- default: nl
- instruction:
- selector:
- text: {}
- name: Instruction
- required: false
- default: >-
- You are a voice assistant for Home Assistant. Answer in plain text. Keep
- it simple and to the point.
- model:
- selector:
- select:
- options:
- - chatgpt_3_5_turbo
- - chatgpt_4o
- - gpt_4o_mini
- name: Model
- required: true
- default: chatgpt_3_5_turbo
- input_text:
- selector:
- entity: {}
- name: Input Text Entity
- required: true
- remove_first_and_last_quotes:
- selector:
- boolean: {}
- name: Remove First And Last Quotes
- default: false
- required: true
- description: ""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement