Addition of an AI chat assistant and a 100MB file upload limit.

This commit is contained in:
2026-09-30 16:30:41 +03:30
parent e94600a02e
commit ae21d9bbc7
8 changed files with 139 additions and 13 deletions
+29
View File
@@ -9,6 +9,14 @@ import { brand, type AskMentoResponse, type AskMentoSourceDto } from '@mento/sha
const props = defineProps<{
personId?: string;
placeholder?: string;
/** زمینهٔ گفتگو برای پاسخ مرتبط‌تر داخل چت */
chatContext?: string;
/** دکمهٔ درج پاسخ در پیش‌نویس پیام */
allowInsert?: boolean;
}>();
const emit = defineEmits<{
insertAnswer: [text: string];
}>();
const question = ref('');
@@ -33,6 +41,7 @@ async function submit() {
const { data } = await api.post<AskMentoResponse>('/ai/ask', {
question: q,
personId: props.personId || undefined,
chatContext: props.chatContext?.trim() || undefined,
});
result.value = data;
} catch (e) {
@@ -46,6 +55,12 @@ async function submit() {
asking.value = false;
}
}
function insertAnswer() {
const text = result.value?.answer?.trim();
if (!text) return;
emit('insertAnswer', text);
}
</script>
<template>
@@ -73,6 +88,14 @@ async function submit() {
{{ source.label }}
</RouterLink>
</div>
<button
v-if="allowInsert && result.answer.trim()"
type="button"
class="insert-btn"
@click="insertAnswer"
>
درج در پیام
</button>
</div>
</section>
</template>
@@ -153,6 +176,12 @@ button:disabled {
padding: 0.18rem 0.55rem;
}
.insert-btn {
margin-top: 0.65rem;
width: 100%;
background: #0f766e;
}
.error {
margin: 0;
color: #b91c1c;