- Implement comprehensive AI financial query system with function-based interactions - Add detailed debug logging for AI responses and function calls - Extend BalanceSheet and IncomeStatement models with AI-friendly methods - Create robust error handling and fallback mechanisms for AI queries - Update chat and message views to support debug mode and enhanced rendering - Add AI query routes and initial test coverage for financial assistant
21 lines
580 B
JavaScript
21 lines
580 B
JavaScript
import { Controller } from "@hotwired/stimulus"
|
|
|
|
// Connects to data-controller="example-question"
|
|
export default class extends Controller {
|
|
static values = { text: String }
|
|
|
|
fillForm(event) {
|
|
event.preventDefault()
|
|
|
|
// Find the textarea in the form
|
|
const textarea = document.querySelector("textarea[name='message[content]']")
|
|
if (!textarea) return
|
|
|
|
// Set the value and focus
|
|
textarea.value = this.textValue
|
|
textarea.focus()
|
|
|
|
// Trigger input event to resize the textarea if using autogrow
|
|
textarea.dispatchEvent(new Event('input'))
|
|
}
|
|
}
|