diff --git a/app/Http/Requests/AiGenerateFormRequest.php b/app/Http/Requests/AiGenerateFormRequest.php index 6aac73580..eeac72429 100644 --- a/app/Http/Requests/AiGenerateFormRequest.php +++ b/app/Http/Requests/AiGenerateFormRequest.php @@ -14,7 +14,7 @@ class AiGenerateFormRequest extends FormRequest public function rules() { return [ - 'form_prompt' => 'required|string' + 'form_prompt' => 'required|string|max:1000' ]; } } diff --git a/app/Jobs/Form/GenerateAiForm.php b/app/Jobs/Form/GenerateAiForm.php index 04d595c52..3e19a3e20 100644 --- a/app/Jobs/Form/GenerateAiForm.php +++ b/app/Jobs/Form/GenerateAiForm.php @@ -55,7 +55,7 @@ public function handle() } catch (\Exception $e) { $this->completion->update([ 'status' => AiFormCompletion::STATUS_FAILED, - 'result' => $e->getMessage() + 'result' => ['error' => $e->getMessage()] ]); } diff --git a/app/Models/Forms/Form.php b/app/Models/Forms/Form.php index c932e9a60..bf52c0939 100644 --- a/app/Models/Forms/Form.php +++ b/app/Models/Forms/Form.php @@ -218,6 +218,11 @@ public function getHasPasswordAttribute() return !empty($this->password); } + public function getRemovedPropertiesAttribute() + { + return $this->attributes['removed_properties'] ?? []; + } + /** * Relationships */ diff --git a/database/migrations/2023_10_13_080104_change_type_of_form_prompt_in_ai_form_completions.php b/database/migrations/2023_10_13_080104_change_type_of_form_prompt_in_ai_form_completions.php new file mode 100644 index 000000000..5d847655e --- /dev/null +++ b/database/migrations/2023_10_13_080104_change_type_of_form_prompt_in_ai_form_completions.php @@ -0,0 +1,32 @@ +text('form_prompt')->change(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('ai_form_completions', function (Blueprint $table) { + $table->string('form_prompt')->change(); + }); + } +};