Skip to content

Commit

Permalink
add the Force to emails as well
Browse files Browse the repository at this point in the history
  • Loading branch information
alnutile committed Jul 24, 2024
1 parent 8c72719 commit 78f6830
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/Http/Controllers/AssistantEmailBoxSourceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ protected function makeSource(array $validated, Collection $collection): void
'details' => $validated['details'],
'recurring' => $validated['recurring'],
'active' => $validated['active'],
'force' => data_get($validated, 'force', false),
'collection_id' => $collection->id,
'user_id' => $this->getUserId($collection),
'type' => $this->sourceTypeEnum,
Expand Down
2 changes: 2 additions & 0 deletions app/Http/Controllers/Sources/EmailBoxSourceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ protected function makeSource(array $validated, Collection $collection): void
'details' => $validated['details'],
'recurring' => $validated['recurring'],
'active' => $validated['active'],
'force' => data_get($validated, 'force', false),
'user_id' => $this->getUserId($collection),
'collection_id' => $collection->id,
'type' => $this->sourceTypeEnum,
Expand Down Expand Up @@ -77,6 +78,7 @@ protected function updateSource(Source $source, array $validated): void
$source->update([
'title' => $validated['title'],
'details' => $validated['details'],
'force' => data_get($validated, 'force', false),
'recurring' => $validated['recurring'],
'active' => $validated['active'],
]);
Expand Down
1 change: 1 addition & 0 deletions app/Http/Middleware/HandleInertiaRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public function version(Request $request): ?string
public function share(Request $request): array
{
return array_merge(parent::share($request), [
'email_name' => config('llmlarahub.email_name'),
'steps' => Setting::createNewSetting()->steps,
'llms' => Setting::getLlms(),
'active_llms' => Setting::getAllActiveLlms(),
Expand Down
1 change: 1 addition & 0 deletions config/llmlarahub.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

return [
'email_name' => env('LARALAMMA_EMAIL_NAME', 'assistant'),
'domain' => env('LARALAMMA_DOMAIN', 'larallama.io'),
'collection' => [
'system_prompt' => 'This is a collection of data the user has imported that they will
Expand Down
4 changes: 2 additions & 2 deletions resources/js/Pages/Sources/EmailBoxSource/Components/Card.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup>
import {Link, useForm} from "@inertiajs/vue3";
import {Link, useForm, usePage} from "@inertiajs/vue3";
import {useToast} from "vue-toastification";
import Settings from "@/Pages/Sources/Cards/Settings.vue";
import Clipboard from "@/Components/Clipboard.vue";
Expand All @@ -14,7 +14,7 @@ const props = defineProps({
const form = useForm({})
const email = computed(() => {
return `assistant+${ props.source.slug }@laralamma.ai`
return `${usePage().props.email_name}+${ props.source.slug }@laralamma.ai`
})
const run = (source) => {
Expand Down
14 changes: 14 additions & 0 deletions resources/js/Pages/Sources/EmailBoxSource/Components/Resources.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@
<InputError :message="modelValue.errors.details" />
</div>


<div>
<InputLabel value="Force Repeat"/>
<input v-model="modelValue.force" type="checkbox" />
<InputError :message="modelValue.errors.force" />
<div class="text-xs prose m-2">
by default the system will only run the first time for a url or an email.
But if you want to to try again just check this box.
This can be good if you are checking a home page for updates.
Or a feed for updates. But NOT if you are checking an email box for emails and
do not want to repeat check the same email.
</div>
</div>

<div class="border-secondary border rounded p-5">
<h2>These will be encrypted</h2>

Expand Down
1 change: 1 addition & 0 deletions resources/js/Pages/Sources/EmailBoxSource/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const form = useForm({
title: '',
details: '',
recurring: 'not',
force: false,
secrets: {
username: "[email protected]",
password: "password",
Expand Down
1 change: 1 addition & 0 deletions resources/js/Pages/Sources/EmailBoxSource/Edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const form = useForm({
title: props.source.data.title,
details: props.source.data.details,
active: props.source.data.active,
force: props.source.data.force,
recurring: props.source.data.recurring,
secrets: {
username: props.source.data.secrets.username,
Expand Down
2 changes: 1 addition & 1 deletion resources/js/Pages/Sources/EmailSource/Components/Card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const props = defineProps({
const form = useForm({})
const email = computed(() => {
return `assistant+${ props.source.slug }@${ usePage().props.domain }`
return `${ usePage().props.email_name }+${ props.source.slug }@${ usePage().props.domain }`
})
const run = (source) => {
Expand Down
13 changes: 13 additions & 0 deletions resources/js/Pages/Sources/EmailSource/Components/Resources.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@
</div>


<div>
<InputLabel value="Force Repeat"/>
<input v-model="modelValue.force" type="checkbox" />
<InputError :message="modelValue.errors.force" />
<div class="text-xs prose m-2">
by default the system will only run the first time for a url or an email.
But if you want to to try again just check this box.
This can be good if you are checking a home page for updates.
Or a feed for updates. But NOT if you are checking an email box for emails and
do not want to repeat check the same email.
</div>
</div>

<div>
<InputLabel value="Recurring"/>
<select
Expand Down
1 change: 1 addition & 0 deletions resources/js/Pages/Sources/EmailSource/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const props = defineProps({
const form = useForm({
title: '',
details: '',
force: false,
recurring: 'not',
active: true
});
Expand Down
1 change: 1 addition & 0 deletions resources/js/Pages/Sources/EmailSource/Edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const props = defineProps({
const form = useForm({
title: props.source.data.title,
force: props.source.data.force,
details: props.source.data.details,
active: props.source.data.active,
recurring: props.source.data.recurring
Expand Down

0 comments on commit 78f6830

Please sign in to comment.