diff --git a/client/src/components/Assistant/assistantFollowUpRules.test.ts b/client/src/components/Assistant/assistantFollowUpRules.test.ts index 16c8d584c..241351e43 100644 --- a/client/src/components/Assistant/assistantFollowUpRules.test.ts +++ b/client/src/components/Assistant/assistantFollowUpRules.test.ts @@ -121,4 +121,40 @@ describe('the questions an answer offers', () => { expect(followUpsFor(offered, true).map((f) => f.text)).toEqual(['Yes, plan it']); expect(followUpsFor(of([{ type: 'text', text: 'Here it is.' }]), true).map((f) => f.id)).toEqual(['more', 'next']); }); + + it('FE-AI-FOLLOW-008: the answer to an attached file offers what the server chose, also under its booking cards', () => { + const read = { + type: 'tool-call' as const, + toolCallId: 'r', + toolName: 'read_booking_file', + args: { name: 'AirBnB Buchung.pdf' }, + result: { bookings: [], reason: 'ai_not_configured' }, + }; + const chips = { + type: 'data-trek-follow-ups' as const, + data: { questions: ['Keep it in Files', 'What is in the file?'] }, + }; + const empty = of([ + read, + { type: 'text', text: 'I could not find a booking. What should I do with the file?' }, + chips, + ]); + expect(followUpsFor(empty, true).map((f) => f.text)).toEqual(['Keep it in Files', 'What is in the file?']); + const change = { + toolCallId: 'b', + verbKey: 'importBooking', + subject: 'Casa', + rows: [], + dayId: null, + placeIds: [], + undoable: false, + }; + const found = of([ + read, + { type: 'text', text: 'I found 1 booking.' }, + { type: 'data-trek-change', data: change as AssistantChangePreview }, + { type: 'data-trek-follow-ups', data: { questions: ['Keep the file with this booking'] } }, + ]); + expect(followUpsFor(found, true).map((f) => f.text)).toEqual(['Keep the file with this booking']); + }); }); diff --git a/server/src/nest/assistant/assistant-attach-answer.ts b/server/src/nest/assistant/assistant-attach-answer.ts new file mode 100644 index 000000000..e3ad9a447 --- /dev/null +++ b/server/src/nest/assistant/assistant-attach-answer.ts @@ -0,0 +1,88 @@ +import type { BookingReadReason } from './assistant-booking-import.service'; +import type { TripCard } from './assistant-context'; +import type { AssistantWords } from './assistant-words'; +import { MAX_FOLLOW_UPS } from '@trek/shared'; + +/** + * The words the server answers an attached booking file with, before any + * model is asked: one line that names the file and what TREK found in it + * (and why it found nothing), then up to three chips with what makes sense + * to do with the file next. A chip sends its words as an ordinary chat + * message, so it goes through the model like anything the user types. + */ + +/** What the chips are chosen from: what the file held, and what the user may do with it on this trip. */ +export interface AttachFacts { + /** The bookings the file proposes. */ + found: number; + /** TREK read text out of the file, so the model could read it too. */ + readable: boolean; + /** The file's type is allowed in Files and the user may upload there. */ + canKeep: boolean; + /** The user may also change what a file is attached to. */ + canLink: boolean; + /** The trip has a booking or an expense the file could be attached to. */ + hasTargets: boolean; + /** The user may add bookings to the trip. */ + canBook: boolean; +} + +/** Each chip's words, as literal keys so the i18n check sees them. */ +const CHIPS = { + keep: 'assistant.attach.chip.keep', + book: 'assistant.attach.chip.book', + attach: 'assistant.attach.chip.attach', + read: 'assistant.attach.chip.read', + keepWithBooking: 'assistant.attach.chip.keepWithBooking', +} as const; + +/** Why a file held no booking, in the user's words. */ +const WHY: Readonly> = { + ai_not_configured: 'assistant.attach.why.aiNotConfigured', + ai_failed: 'assistant.attach.why.aiFailed', + no_text: 'assistant.attach.why.noText', + nothing_found: 'assistant.attach.why.nothingFound', +}; + +/** + * The chips under the answer, in order, at most MAX_FOLLOW_UPS. A file with + * bookings asks to keep it with the booking once it is added; one without + * offers to keep it, to make a booking from its text, to attach it to what + * the trip holds, and to say what is in it. + */ +export function attachChipKeys(facts: AttachFacts): string[] { + const wanted = + facts.found > 0 + ? [facts.canKeep && facts.canLink && CHIPS.keepWithBooking, facts.readable && CHIPS.read] + : [ + facts.canKeep && CHIPS.keep, + facts.readable && facts.canBook && CHIPS.book, + facts.canKeep && facts.canLink && facts.hasTargets && CHIPS.attach, + facts.readable && CHIPS.read, + ]; + return wanted.filter((key): key is (typeof CHIPS)[keyof typeof CHIPS] => !!key).slice(0, MAX_FOLLOW_UPS); +} + +/** The answer's line: what TREK found in the file, or that it found nothing, why, and the question what to do. */ +export function attachLine( + words: AssistantWords, + name: string, + found: number, + reason: BookingReadReason | null, +): string { + if (found > 0) return words.count('assistant.attach.found', found, { name }); + return [ + words.text('assistant.attach.none', { name }), + ...(reason ? [words.text(WHY[reason])] : []), + words.text('assistant.attach.ask'), + ].join(' '); +} + +/** Whether the trip has a booking or an expense a file could be kept with. */ +export function hasLinkTargets(card: TripCard): boolean { + if (card.reservations.size > 0) return true; + const summary = card.sources.summary; + const budget = + summary && typeof summary === 'object' ? (summary as { budget?: { items?: unknown } }).budget : undefined; + return Array.isArray(budget?.items) && budget.items.length > 0; +} diff --git a/server/src/nest/assistant/assistant-attached-file.ts b/server/src/nest/assistant/assistant-attached-file.ts index 5fc4a95d2..ddc807297 100644 --- a/server/src/nest/assistant/assistant-attached-file.ts +++ b/server/src/nest/assistant/assistant-attached-file.ts @@ -29,8 +29,14 @@ export interface FileRead { export interface AttachedFileReader { /** The name the read step goes by in the thread. */ readonly readTool: string; - /** The error a file that holds nothing to propose ends the answer with. */ + /** The error a file that holds nothing to propose ends the answer with, unless the reader `acknowledges` it. */ readonly emptyCode: AssistantErrorCode; + /** + * The answer names the file and what was found in it in a line of its own, + * a file without anything says why, and chips offer what to do with it + * (assistant-attach-answer.ts); no answer ends on the error then. + */ + readonly acknowledges: boolean; /** Refuses a file nobody here can read, before a turn begins. */ ensureReadable(userId: number, file: Express.Multer.File): Promise; /** What the file holds, at most a step's worth. Persists nothing. */ diff --git a/server/src/nest/assistant/assistant-booking-import.service.ts b/server/src/nest/assistant/assistant-booking-import.service.ts index f1f448d79..a88c20a3a 100644 --- a/server/src/nest/assistant/assistant-booking-import.service.ts +++ b/server/src/nest/assistant/assistant-booking-import.service.ts @@ -63,7 +63,9 @@ export function emptyReason(preview: BookingImportPreviewResponse, aiAvailable: @Injectable() export class AssistantBookingImportService implements AttachedFileReader { readonly readTool = READ_BOOKING_FILE_TOOL; + /** Kept for the answers older builds wrote; this one acknowledges every file instead. */ readonly emptyCode = 'no_bookings_found' as const; + readonly acknowledges = true; constructor( private readonly bookingImport: BookingImportService, diff --git a/server/src/nest/assistant/assistant-file-answer.service.ts b/server/src/nest/assistant/assistant-file-answer.service.ts index b059922cd..ef1f922ae 100644 --- a/server/src/nest/assistant/assistant-file-answer.service.ts +++ b/server/src/nest/assistant/assistant-file-answer.service.ts @@ -1,10 +1,17 @@ +import type { AssistantAttachmentTextStatus } from '../../db/repositories/AssistantAttachments.repository'; import { logError } from '../audit/audit-log.logger'; import { withRequestContext } from '../database/request-context'; +import { AllowedFileTypesService } from '../files/allowed-file-types.service'; +import { isUploadTypeAllowed } from '../files/files.constants'; +import { McpToolGuardsService } from '../mcp-shared/mcp-tool-guards.service'; import type { HeldCall } from './assistant-agent'; +import { attachChipKeys, attachLine, hasLinkTargets, type AttachFacts } from './assistant-attach-answer'; import type { AttachedFileReader, FileRead } from './assistant-attached-file'; -import { todayIn } from './assistant-context'; +import { BOOKING_READ_REASONS, type BookingReadReason } from './assistant-booking-import.service'; +import { todayIn, type TripCard } from './assistant-context'; import { AssistantToolsService } from './assistant-tools.service'; import { readTripCard } from './assistant-trip-scope'; +import { AssistantWords } from './assistant-words'; import { AssistantCardContext } from './cards/card-context'; import type { UiStreamWriter } from './ui-stream.writer'; import { MikroORM } from '@mikro-orm/core'; @@ -16,13 +23,16 @@ import { randomUUID } from 'node:crypto'; /** What the read step of an attached file answers when the file could not be read. */ const FILE_UNREADABLE = 'The file could not be read.'; -/** The turn a file was attached in: who, on which trip, the thread and the answer's first row. */ +/** The turn a file was attached in: who, on which trip, the thread, the answer's first row and the file kept. */ export interface FileTurn extends AssistantClientCtx { userId: number; tripId: number; threadId: number; rowId: number; name: string; + mime: string; + /** How TREK's reading of the file's text went, when it was kept (AssistantAttachmentsService). */ + textStatus: AssistantAttachmentTextStatus; } /** How the answer's row is written: AssistantService's, which owns the rows and their transactions. */ @@ -39,24 +49,41 @@ export interface FileAnswerOut { rows: FileAnswerRows; } +/** A file that proposes nothing holds no change. */ +const NOTHING_HELD: { + held: HeldCall[]; + parts: AssistantMessagePart[]; + shown: ReadonlyMap>; +} = { held: [], parts: [], shown: new Map() }; + +/** The reason a read step names, when it is one this build knows. */ +function reasonOf(found: Record): BookingReadReason | null { + const reason = found.reason; + return (BOOKING_READ_REASONS as readonly unknown[]).includes(reason) ? (reason as BookingReadReason) : null; +} + /** * The answer to a file the user attached in the trip chat, written by the * server itself, in the answer's first row: the read step, then one held * change per booking (`import_booking`) or track (`import_tour_file`), each - * with its card. No model is asked. + * with its card. A booking file is always answered with a line that names + * what was found (or why nothing was) and chips with what to do with the + * file next (assistant-attach-answer.ts). No model is asked. */ @Injectable() export class AssistantFileAnswers { constructor( private readonly tools: AssistantToolsService, private readonly cardContext: AssistantCardContext, + private readonly guards: McpToolGuardsService, + private readonly allowedTypes: AllowedFileTypesService, private readonly orm: MikroORM, ) {} /** - * Reads the attached file and proposes what it found. A file without any - * ends the answer with the reader's code; one that cannot be read, with - * `generic`. + * Reads the attached file and proposes what it found. A file that cannot + * be read ends the answer with `generic`; a route file without any track, + * with its reader's code. * * @txIndependent the row is written once the file was read, in a * transaction of its own. @@ -93,7 +120,7 @@ export class AssistantFileAnswers { return; } w.toolOutput(readId, found); - if (proposals.length === 0) { + if (proposals.length === 0 && !reader.acknowledges) { await rows.save([readPart(found)], 'error'); w.finishStep(); w.error(reader.emptyCode); @@ -101,14 +128,37 @@ export class AssistantFileAnswers { return; } const card = await readTripCard(this.tools, turn.userId, turn.tripId); + const said = reader.acknowledges ? await this.acknowledgement(turn, card, proposals.length, reasonOf(found)) : null; + if (said) w.text(said.line); + const held = proposals.length > 0 ? await this.held(turn, card, read) : NOTHING_HELD; + const tail: AssistantMessagePart[] = said?.chips ? [{ type: 'data-trek-follow-ups', data: said.chips }] : []; + const parts: AssistantMessagePart[] = [ + readPart(found), + ...(said ? [{ type: 'text' as const, text: said.line }] : []), + ...held.parts, + ...tail, + ]; + if (held.held.length > 0) await rows.hold(parts, held.held); + else await rows.save(parts, 'complete'); + for (const change of held.held) { + w.toolInput(change.id, change.toolName, held.shown.get(change.id) ?? change.args); + w.approvalRequest(change.id); + w.change(change.preview); + } + if (said?.chips) w.followUps(said.chips); + w.finishStep(); + w.finish(held.held.length > 0 ? 'tool-calls' : 'stop'); + } + + /** The changes the file proposes, held with their cards, and the parts that show them. */ + private async held(turn: FileTurn, card: TripCard, read: FileRead) { const ctx = this.cardContext.contextOf(card, new Map(), turn.locale, todayIn(turn.timeZone, new Date())); - const proposed = proposals.map((proposal) => ({ ...proposal, id: randomUUID() })); + const proposed = read.proposals.map((proposal) => ({ ...proposal, id: randomUUID() })); // The thread shows a call as the reader shows it; the held call keeps everything it runs with. const shown = new Map>(proposed.map((c) => [c.id, c.shownArgs ?? c.args])); const described = await this.cardContext.describeProposed(turn.userId, turn.tripId, ctx, proposed); const held: HeldCall[] = described.map((change) => ({ ...change, providerCallId: `import_${change.id}` })); const parts: AssistantMessagePart[] = [ - readPart(found), ...held.map((change): AssistantMessagePart => ({ type: 'tool-call', toolCallId: change.id, @@ -118,13 +168,36 @@ export class AssistantFileAnswers { })), ...held.map((change): AssistantMessagePart => ({ type: 'data-trek-change', data: change.preview })), ]; - await rows.hold(parts, held); - for (const change of held) { - w.toolInput(change.id, change.toolName, shown.get(change.id) ?? change.args); - w.approvalRequest(change.id); - w.change(change.preview); - } - w.finishStep(); - w.finish('tool-calls'); + return { held, parts, shown }; + } + + /** The answer's line and its chips, in the user's language; no chips when nothing fits. */ + private async acknowledgement(turn: FileTurn, card: TripCard, found: number, reason: BookingReadReason | null) { + const words = await AssistantWords.of(turn.locale); + const facts = await withRequestContext(this.orm, () => this.factsOf(turn, card, found)); + const questions = attachChipKeys(facts).map((key) => words.text(key)); + return { + line: attachLine(words, turn.name, found, reason), + chips: questions.length > 0 ? { questions } : null, + }; + } + + /** What the chips are chosen from: the file, and the user's rights on the trip. */ + private async factsOf(turn: FileTurn, card: TripCard, found: number): Promise { + const { userId, tripId } = turn; + const [upload, edit, book, allowed] = await Promise.all([ + this.guards.hasTripPermission('file_upload', tripId, userId), + this.guards.hasTripPermission('file_edit', tripId, userId), + this.guards.hasTripPermission('reservation_edit', tripId, userId), + this.allowedTypes.get(), + ]); + return { + found, + readable: turn.textStatus === 'ok', + canKeep: upload && isUploadTypeAllowed(turn.name, turn.mime, allowed), + canLink: edit, + hasTargets: hasLinkTargets(card), + canBook: book, + }; } } diff --git a/server/src/nest/assistant/assistant-proposal-sports.ts b/server/src/nest/assistant/assistant-proposal-sports.ts index 590267c10..1b5b03291 100644 --- a/server/src/nest/assistant/assistant-proposal-sports.ts +++ b/server/src/nest/assistant/assistant-proposal-sports.ts @@ -1,6 +1,6 @@ +import { localeTable, supportedLocale } from './assistant-words'; import { recordOf, type Row } from './cards/card-values'; import { haversineMetres } from '@trek/shared'; -import { SUPPORTED_LANGUAGE_CODES } from '@trek/shared/i18n'; /** * "Plan this" on a paddle or ski plan an answer showed (plan_paddle_route, @@ -104,29 +104,11 @@ const TYPE_WORD_KEYS: Readonly> = { plan_ski_route: 'tourTypes.ski', }; -/** The words of one locale's table, or none when it cannot be read. */ -async function wordsOf(language: string): Promise> { - try { - // A supported code only, so the path is one of the package's own locale entries. - const loaded: unknown = await import(`@trek/shared/i18n/${language}`); - const words = (loaded as { default?: unknown } | null)?.default; - return words !== null && typeof words === 'object' ? (words as Record) : {}; - } catch { - return {}; - } -} - /** A plan's tour type in the user's language ("Paddeltour"), English where the language has no table. */ export async function tourTypeWord(locale: string, toolName: SportPlanTool): Promise { - const language = locale.split('-')[0] ?? 'en'; - const code = SUPPORTED_LANGUAGE_CODES.includes(locale) - ? locale - : SUPPORTED_LANGUAGE_CODES.includes(language) - ? language - : 'en'; const key = TYPE_WORD_KEYS[toolName]; - const own = (await wordsOf(code))[key]; + const own = (await localeTable(supportedLocale(locale)))[key]; if (typeof own === 'string') return own; - const english = (await wordsOf('en'))[key]; + const english = (await localeTable('en'))[key]; return typeof english === 'string' ? english : 'Tour'; } diff --git a/server/src/nest/assistant/assistant-tour-file.service.ts b/server/src/nest/assistant/assistant-tour-file.service.ts index a21e4d4ba..4fa459597 100644 --- a/server/src/nest/assistant/assistant-tour-file.service.ts +++ b/server/src/nest/assistant/assistant-tour-file.service.ts @@ -40,6 +40,7 @@ function trackFact(track: TourFileTrack) { export class AssistantTourFileService implements AttachedFileReader { readonly readTool = READ_TOUR_FILE_TOOL; readonly emptyCode = 'no_tracks_found' as const; + readonly acknowledges = false; constructor( private readonly files: TourFileReadService, diff --git a/server/src/nest/assistant/assistant-words.ts b/server/src/nest/assistant/assistant-words.ts new file mode 100644 index 000000000..a7ff06c00 --- /dev/null +++ b/server/src/nest/assistant/assistant-words.ts @@ -0,0 +1,64 @@ +import { resolvePluralKey } from '@trek/shared'; +import { getIntlLanguage, SUPPORTED_LANGUAGE_CODES } from '@trek/shared/i18n'; + +/** + * The few words the assistant writes itself, without a model (the line that + * answers an attached file, the chips under it, a tour type's name), in the + * user's language from the shared locale tables, English where a table has + * no such key. + */ + +type Table = Readonly>; + +/** The supported code a request's locale reads as: itself, its language, or English. */ +export function supportedLocale(locale: string): string { + if (SUPPORTED_LANGUAGE_CODES.includes(locale)) return locale; + const language = locale.split('-')[0] ?? 'en'; + return SUPPORTED_LANGUAGE_CODES.includes(language) ? language : 'en'; +} + +/** The words of one locale's table, or none when it cannot be read. */ +export async function localeTable(code: string): Promise { + try { + // A supported code only, so the path is one of the package's own locale entries. + const loaded: unknown = await import(`@trek/shared/i18n/${code}`); + const words = (loaded as { default?: unknown } | null)?.default; + return words !== null && typeof words === 'object' ? (words as Table) : {}; + } catch { + return {}; + } +} + +function filled(text: string, params: Readonly>): string { + return text.replace(/\{(\w+)\}/g, (whole, name: string) => (name in params ? String(params[name]) : whole)); +} + +/** One locale's words, with English behind them. */ +export class AssistantWords { + private constructor( + private readonly code: string, + private readonly own: Table, + private readonly english: Table, + ) {} + + static async of(locale: string): Promise { + const code = supportedLocale(locale); + const [own, english] = await Promise.all([localeTable(code), code === 'en' ? null : localeTable('en')]); + return new AssistantWords(code, own, english ?? own); + } + + /** The string under `key` with its params filled in; the key itself where no table has it. */ + text(key: string, params: Readonly> = {}): string { + const value = this.own[key] ?? this.english[key]; + return filled(typeof value === 'string' ? value : key, params); + } + + /** The form of a count-bearing string the language picks for `count`, with `count` among its params. */ + count(key: string, count: number, params: Readonly> = {}): string { + const all = { ...params, count }; + const own = resolvePluralKey(this.own, key, count, getIntlLanguage(this.code)); + if (own) return filled(String(this.own[own]), all); + const english = resolvePluralKey(this.english, key, count, 'en'); + return english ? filled(String(this.english[english]), all) : key; + } +} diff --git a/server/src/nest/assistant/assistant.module.ts b/server/src/nest/assistant/assistant.module.ts index b2e1263d3..964d0431b 100644 --- a/server/src/nest/assistant/assistant.module.ts +++ b/server/src/nest/assistant/assistant.module.ts @@ -9,6 +9,7 @@ import { AuditModule } from '../audit/audit.module'; import { BookingImportModule } from '../booking-import/booking-import.module'; import { CollabModule } from '../collab/collab.module'; import { RateLimitModule } from '../common/rate-limit.module'; +import { AllowedFileTypesModule } from '../files/allowed-file-types.module'; import { JourneyBookModule } from '../journey/journey-book.module'; import { JourneyDomainModule } from '../journey/journey-domain.module'; import { LlmParseModule } from '../llm-parse/llm-parse.module'; @@ -92,6 +93,8 @@ import { Module } from '@nestjs/common'; // AI import reads it. StorageModule, LlmParseModule, + // The chips under the answer offer to keep a file only where Files takes its type. + AllowedFileTypesModule, MikroOrmModule.forFeature([AssistantThreads, AssistantMessages, AssistantToolCalls, AssistantAttachments]), ], controllers: [ diff --git a/server/src/nest/assistant/assistant.service.ts b/server/src/nest/assistant/assistant.service.ts index e122d8a78..84f1bdc55 100644 --- a/server/src/nest/assistant/assistant.service.ts +++ b/server/src/nest/assistant/assistant.service.ts @@ -312,7 +312,18 @@ export class AssistantService { const stopKeepalive = armKeepalive(stream); try { const { locale, timeZone } = req; - const turn = { userId, tripId, threadId: begun.threadId, rowId: begun.rowId, locale, timeZone, name }; + const { threadId, rowId } = begun; + const turn = { + userId, + tripId, + threadId, + rowId, + locale, + timeZone, + name, + mime: kept.mime, + textStatus: kept.textStatus, + }; await this.fileAnswers.answer(turn, file, reader, { w, signal, rows: this.answerRows(turn) }); } catch (err) { const reason = err instanceof Error ? err.message : String(err); diff --git a/server/tests/e2e/assistant-attachments.e2e.test.ts b/server/tests/e2e/assistant-attachments.e2e.test.ts index b80a23e34..435d35d0e 100644 --- a/server/tests/e2e/assistant-attachments.e2e.test.ts +++ b/server/tests/e2e/assistant-attachments.e2e.test.ts @@ -7,7 +7,9 @@ * * Covered: the file is kept with its conversation (a row and its bytes) under * the id its message part carries, and goes with the thread; a storage that - * refuses the bytes refuses the turn before anything is written. + * refuses the bytes refuses the turn before anything is written; a file + * without a booking is answered with a line that says why and chips, in the + * user's language, never with an error. */ import { buildApp } from '../../src/bootstrap'; import { AssistantAttachments } from '../../src/db/entities/AssistantAttachments.entity'; @@ -144,12 +146,18 @@ async function post(path: string, userId: number, body: object): Promise /** The booking file as the client uploads it: multipart, the context as text fields. */ const BOOKING_TEXT = 'Your stay at Casa Lisboa\nCheck-in 2026-06-11\nConfirmation HM4X2'; -async function upload(path: string, userId: number, opts: { name?: string; threadId?: number } = {}): Promise { +interface UploadOpts { + name?: string; + threadId?: number; + locale?: string; +} + +async function upload(path: string, userId: number, opts: UploadOpts = {}): Promise { const name = opts.name ?? 'AirBnB Buchung.txt'; let req = request(nestApp.getHttpServer()) .post(path) .set('Cookie', sessionCookie(userId)) - .field('locale', CTX.locale) + .field('locale', opts.locale ?? CTX.locale) .field('timeZone', CTX.timeZone); if (opts.threadId !== undefined) req = req.field('threadId', String(opts.threadId)); req = req.attach('file', Buffer.from(BOOKING_TEXT), { filename: name, contentType: 'text/plain' }); @@ -181,6 +189,11 @@ function stubImport(preview: BookingImportPreviewResponse) { return () => spies.forEach((spy) => spy.mockRestore()); } +const NO_BOOKING: BookingImportPreviewResponse = { + items: [], + warnings: ['AirBnB Buchung.txt: no reservations found'], +}; + const ONE_BOOKING: BookingImportPreviewResponse = { items: [{ type: 'hotel', title: 'Casa Lisboa', source: { fileName: 'AirBnB Buchung.txt', index: 0 } }], warnings: [], @@ -254,4 +267,63 @@ describe('Trip assistant: attached files', () => { expect(await countRows(orm, AssistantThreads, { trip: t.tripId })).toBe(0); expect(await countRows(orm, AssistantAttachments, { trip: t.tripId })).toBe(0); }); + + it('ATTE2E-003: a file without a booking is answered with why and what to do next, never with an error', async () => { + const t = await travelerWithTrip(); + const restore = stubImport(NO_BOOKING); + let turn: Answer; + try { + turn = await upload(`${t.base}/attachments`, t.userId); + } finally { + restore(); + } + expect(turn.status).toBe(200); + expect(ofType(turn.chunks, 'error')).toEqual([]); + expect(ofType(turn.chunks, 'finish')[0]).toMatchObject({ finishReason: 'stop' }); + expect(ofType(turn.chunks, 'tool-output-available')[0].output).toEqual({ + bookings: [], + reason: 'ai_not_configured', + }); + const line = ofType(turn.chunks, 'text-delta') + .map((chunk) => chunk.delta) + .join(''); + expect(line).toBe( + 'I could not find a booking in AirBnB Buchung.txt. AI reading is not set up for imports here, so only ' + + 'TREK’s own reader looked at it. What should I do with the file?', + ); + expect(ofType(turn.chunks, 'data-trek-follow-ups')[0].data.questions).toEqual([ + 'Keep it in Files', + 'Create a booking from it', + 'What is in the file?', + ]); + const threadId = ofType(turn.chunks, 'data-trek-thread')[0].data.threadId; + const shown = await get(`${t.base}/threads/${threadId}`, t.userId); + expect(shown.body.messages[1].status).toBe('complete'); + expect(shown.body.messages[1].parts.map((part: { type: string }) => part.type)).toEqual([ + 'tool-call', + 'text', + 'data-trek-follow-ups', + ]); + + provider.script = [say('Shall I keep it?')]; + await post(`${t.base}/chat`, t.userId, { ...CTX, threadId, text: 'Keep it in Files' }); + const sent = provider.requests[0].messages.map((message) => String(message.content ?? '')).join(' '); + expect(sent).toContain('found no booking in it: AI reading for imports is not set up on this server'); + }); + + it('ATTE2E-004: the answer is written in the language of the request', async () => { + const t = await travelerWithTrip(); + const restore = stubImport(NO_BOOKING); + try { + const turn = await upload(`${t.base}/attachments`, t.userId, { locale: 'de' }); + const line = ofType(turn.chunks, 'text-delta') + .map((chunk) => chunk.delta) + .join(''); + expect(line).toContain('Ich habe in AirBnB Buchung.txt keine Buchung gefunden.'); + expect(line).toContain('Was soll ich mit der Datei machen?'); + expect(ofType(turn.chunks, 'data-trek-follow-ups')[0].data.questions[0]).toBe('In Dateien ablegen'); + } finally { + restore(); + } + }); }); diff --git a/server/tests/e2e/assistant.e2e.test.ts b/server/tests/e2e/assistant.e2e.test.ts index 4bdcca0df..2b7cdff3c 100644 --- a/server/tests/e2e/assistant.e2e.test.ts +++ b/server/tests/e2e/assistant.e2e.test.ts @@ -707,13 +707,23 @@ describe('Trip assistant e2e', () => { 'tool-input-start', 'tool-input-available', 'tool-output-available', + 'text-start', + 'text-delta', + 'text-end', 'tool-input-start', 'tool-input-available', 'tool-approval-request', 'data-trek-change', + 'data-trek-follow-ups', 'finish-step', 'finish', ]); + expect(ofType(turn.chunks, 'text-delta')[0].delta).toBe( + 'I found 1 booking in ticket.pdf. Add it below if it looks right.', + ); + expect(ofType(turn.chunks, 'data-trek-follow-ups')[0].data.questions).toEqual([ + 'Keep the file with this booking', + ]); expect(ofType(turn.chunks, 'tool-input-start')[0].toolName).toBe('read_booking_file'); expect(ofType(turn.chunks, 'data-trek-change')[0].data).toMatchObject({ verbKey: 'importBooking', diff --git a/server/tests/unit/nest/assistant/assistant-attach-answer.test.ts b/server/tests/unit/nest/assistant/assistant-attach-answer.test.ts new file mode 100644 index 000000000..26a4b6865 --- /dev/null +++ b/server/tests/unit/nest/assistant/assistant-attach-answer.test.ts @@ -0,0 +1,97 @@ +/** + * The server's own answer to an attached booking file: which chips it offers + * for what the file held and what the user may do, the line it writes in the + * user's language, and the words it is written with. + */ +import { + attachChipKeys, + attachLine, + hasLinkTargets, + type AttachFacts, +} from '../../../../src/nest/assistant/assistant-attach-answer'; +import type { TripCard } from '../../../../src/nest/assistant/assistant-context'; +import { AssistantWords, supportedLocale } from '../../../../src/nest/assistant/assistant-words'; + +import { describe, expect, it } from 'vitest'; + +const ALL: AttachFacts = { + found: 0, + readable: true, + canKeep: true, + canLink: true, + hasTargets: true, + canBook: true, +}; + +const chip = (name: string) => `assistant.attach.chip.${name}`; + +describe('attachChipKeys', () => { + it('ASTACH-001: a file without a booking offers to keep it, book from it and attach it, three at most', () => { + expect(attachChipKeys(ALL)).toEqual([chip('keep'), chip('book'), chip('attach')]); + expect(attachChipKeys({ ...ALL, hasTargets: false })).toEqual([chip('keep'), chip('book'), chip('read')]); + }); + + it('ASTACH-002: what the user may not do, and what an unreadable file cannot give, is never offered', () => { + expect(attachChipKeys({ ...ALL, canKeep: false })).toEqual([chip('book'), chip('read')]); + expect(attachChipKeys({ ...ALL, canBook: false })).toEqual([chip('keep'), chip('attach'), chip('read')]); + expect(attachChipKeys({ ...ALL, canLink: false, canBook: false })).toEqual([chip('keep'), chip('read')]); + expect(attachChipKeys({ ...ALL, readable: false })).toEqual([chip('keep'), chip('attach')]); + expect(attachChipKeys({ ...ALL, readable: false, canKeep: false })).toEqual([]); + }); + + it('ASTACH-003: a file with bookings asks to keep it with the booking', () => { + expect(attachChipKeys({ ...ALL, found: 2 })).toEqual([chip('keepWithBooking'), chip('read')]); + expect(attachChipKeys({ ...ALL, found: 1, canLink: false, readable: false })).toEqual([]); + }); +}); + +describe('attachLine', () => { + it('ASTACH-004: names the file and what was found, or why nothing was, and asks what to do', async () => { + const words = await AssistantWords.of('en'); + expect(attachLine(words, 'trip.pdf', 1, null)).toBe( + 'I found 1 booking in trip.pdf. Add it below if it looks right.', + ); + expect(attachLine(words, 'trip.pdf', 3, null)).toBe('I found 3 bookings in trip.pdf. Add the ones you want below.'); + expect(attachLine(words, 'scan.pdf', 0, 'no_text')).toBe( + 'I could not find a booking in scan.pdf. It holds no readable text, so it is most likely a scan. ' + + 'What should I do with the file?', + ); + expect(attachLine(words, 'a.txt', 0, null)).toBe( + 'I could not find a booking in a.txt. What should I do with the file?', + ); + }); +}); + +describe('AssistantWords', () => { + it('ASTACH-005: picks the form the language takes for the count, and English where a table has no key', async () => { + const ru = await AssistantWords.of('ru-RU'); + expect(ru.count('assistant.attach.found', 21, { name: 'a.pdf' })).toContain('21 бронирование'); + expect(ru.count('assistant.attach.found', 5, { name: 'a.pdf' })).toContain('5 бронирований'); + expect(ru.text('assistant.attach.chip.keep')).toBe('Сохрани его в Файлы'); + expect(ru.text('assistant.no.such.key')).toBe('assistant.no.such.key'); + const unknown = await AssistantWords.of('xx'); + expect(unknown.text('assistant.attach.none', { name: 'b.pdf' })).toBe('I could not find a booking in b.pdf.'); + expect(unknown.count('assistant.no.such.key', 2)).toBe('assistant.no.such.key'); + }); + + it('ASTACH-006: a locale reads as itself, its language or English', () => { + expect(supportedLocale('zh-TW')).toBe('zh-TW'); + expect(supportedLocale('de-AT')).toBe('de'); + expect(supportedLocale('xx-YY')).toBe('en'); + }); +}); + +describe('hasLinkTargets', () => { + const card = (reservations: number, budgetItems: unknown) => + ({ + reservations: new Map(Array.from({ length: reservations }, (_, i) => [i + 1, {}])), + sources: { summary: { budget: { items: budgetItems } }, places: null }, + }) as unknown as TripCard; + + it('ASTACH-007: a booking or an expense is something to attach a file to', () => { + expect(hasLinkTargets(card(1, []))).toBe(true); + expect(hasLinkTargets(card(0, [{ id: 3 }]))).toBe(true); + expect(hasLinkTargets(card(0, []))).toBe(false); + expect(hasLinkTargets(card(0, undefined))).toBe(false); + }); +}); diff --git a/shared/src/i18n/ar/assistant.ts b/shared/src/i18n/ar/assistant.ts index 739211003..00a568d1e 100644 --- a/shared/src/i18n/ar/assistant.ts +++ b/shared/src/i18n/ar/assistant.ts @@ -553,5 +553,23 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': 'إرسال إلى محادثة الرحلة', 'assistant.admin.chatgptShared': 'أنت تشارك اشتراكك الشخصي في ChatGPT مع الجميع على هذا الخادم: تُحتسب محادثاتهم من خطتك. تحقّق من أن خطتك وشروط OpenAI تسمح بذلك.', + 'assistant.attach.found': 'وجدت {count} حجز في {name}. أضف ما تريده منها أدناه.', + 'assistant.attach.found.zero': 'لم أجد أي حجز في {name}.', + 'assistant.attach.found.one': 'وجدت حجزًا واحدًا في {name}. أضفه أدناه إن بدا صحيحًا.', + 'assistant.attach.found.two': 'وجدت حجزين في {name}. أضف ما تريده منهما أدناه.', + 'assistant.attach.found.few': 'وجدت {count} حجوزات في {name}. أضف ما تريده منها أدناه.', + 'assistant.attach.found.many': 'وجدت {count} حجزًا في {name}. أضف ما تريده منها أدناه.', + 'assistant.attach.none': 'لم أجد أي حجز في {name}.', + 'assistant.attach.why.aiNotConfigured': + 'قراءة الملفات بالذكاء الاصطناعي غير مفعّلة للاستيراد هنا، لذلك فحصه قارئ TREK وحده.', + 'assistant.attach.why.aiFailed': 'لم يتمكن قارئ الذكاء الاصطناعي من قراءته.', + 'assistant.attach.why.noText': 'لا يحتوي على نص قابل للقراءة، والأرجح أنه ملف ممسوح ضوئيًا.', + 'assistant.attach.why.nothingFound': 'لا شيء فيه يبدو كحجز.', + 'assistant.attach.ask': 'ماذا أفعل بالملف؟', + 'assistant.attach.chip.keep': 'احفظه في الملفات', + 'assistant.attach.chip.book': 'أنشئ حجزًا منه', + 'assistant.attach.chip.attach': 'أرفقه بحجز أو بمصروف', + 'assistant.attach.chip.read': 'ماذا يحتوي الملف؟', + 'assistant.attach.chip.keepWithBooking': 'احفظ الملف مع هذا الحجز', }; export default assistant; diff --git a/shared/src/i18n/az/assistant.ts b/shared/src/i18n/az/assistant.ts index 505da4952..35ba3ce67 100644 --- a/shared/src/i18n/az/assistant.ts +++ b/shared/src/i18n/az/assistant.ts @@ -475,5 +475,19 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': 'Səyahət söhbətinə göndər', 'assistant.admin.chatgptShared': 'Öz ChatGPT abunəliyini bu serverdəki hər kəslə paylaşırsan: onların söhbətləri sənin planından çıxılır. Planının və OpenAI şərtlərinin buna icazə verdiyini yoxla.', + 'assistant.attach.found': '{name} faylında {count} bron tapdım. İstədiklərinizi aşağıda əlavə edin.', + 'assistant.attach.found.one': '{name} faylında {count} bron tapdım. Düzgün görünürsə, aşağıda əlavə edin.', + 'assistant.attach.none': '{name} faylında bron tapa bilmədim.', + 'assistant.attach.why.aiNotConfigured': + 'Burada idxal üçün süni intellektlə oxuma qurulmayıb, ona görə fayla yalnız TREK-in öz oxuyucusu baxdı.', + 'assistant.attach.why.aiFailed': 'Süni intellekt oxuyucusu onu oxuya bilmədi.', + 'assistant.attach.why.noText': 'Faylda oxuna bilən mətn yoxdur, çox güman ki, skan edilmiş sənəddir.', + 'assistant.attach.why.nothingFound': 'Faylda bron kimi görünən heç nə yoxdur.', + 'assistant.attach.ask': 'Faylla nə edim?', + 'assistant.attach.chip.keep': 'Fayllarda saxla', + 'assistant.attach.chip.book': 'Ondan bron yarat', + 'assistant.attach.chip.attach': 'Brona və ya xərcə əlavə et', + 'assistant.attach.chip.read': 'Faylda nə var?', + 'assistant.attach.chip.keepWithBooking': 'Faylı bu bronla saxla', }; export default assistant; diff --git a/shared/src/i18n/br/assistant.ts b/shared/src/i18n/br/assistant.ts index 887623989..5446d34f8 100644 --- a/shared/src/i18n/br/assistant.ts +++ b/shared/src/i18n/br/assistant.ts @@ -476,5 +476,19 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': 'Enviar para o chat da viagem', 'assistant.admin.chatgptShared': 'Você compartilha seu próprio plano do ChatGPT com todos neste servidor: os chats deles contam no seu plano. Confira se o seu plano e os termos da OpenAI permitem isso.', + 'assistant.attach.found': 'Encontrei {count} reservas em {name}. Adicione abaixo as que quiser.', + 'assistant.attach.found.one': 'Encontrei {count} reserva em {name}. Adicione abaixo se estiver certa.', + 'assistant.attach.none': 'Não encontrei nenhuma reserva em {name}.', + 'assistant.attach.why.aiNotConfigured': + 'A leitura por IA não está configurada para importações aqui, então só o leitor próprio do TREK analisou o arquivo.', + 'assistant.attach.why.aiFailed': 'O leitor de IA não conseguiu ler o arquivo.', + 'assistant.attach.why.noText': 'O arquivo não tem texto legível, provavelmente é uma digitalização.', + 'assistant.attach.why.nothingFound': 'Nada nele parece uma reserva.', + 'assistant.attach.ask': 'O que devo fazer com o arquivo?', + 'assistant.attach.chip.keep': 'Guardar em Arquivos', + 'assistant.attach.chip.book': 'Criar uma reserva a partir dele', + 'assistant.attach.chip.attach': 'Anexar a uma reserva ou a uma despesa', + 'assistant.attach.chip.read': 'O que tem no arquivo?', + 'assistant.attach.chip.keepWithBooking': 'Guardar o arquivo com esta reserva', }; export default assistant; diff --git a/shared/src/i18n/ca/assistant.ts b/shared/src/i18n/ca/assistant.ts index db4b91ab4..0e35dad4b 100644 --- a/shared/src/i18n/ca/assistant.ts +++ b/shared/src/i18n/ca/assistant.ts @@ -478,5 +478,19 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': 'Envia al xat del viatge', 'assistant.admin.chatgptShared': 'Comparteixes el teu propi pla de ChatGPT amb tothom en aquest servidor: els seus xats compten contra el teu pla. Comprova que el teu pla i les condicions d’OpenAI ho permeten.', + 'assistant.attach.found': 'He trobat {count} reserves a {name}. Afegeix a sota les que vulguis.', + 'assistant.attach.found.one': 'He trobat {count} reserva a {name}. Afegeix-la a sota si et sembla bé.', + 'assistant.attach.none': 'No he trobat cap reserva a {name}.', + 'assistant.attach.why.aiNotConfigured': + 'La lectura amb IA no està configurada per a les importacions, així que només l’ha revisat el lector propi de TREK.', + 'assistant.attach.why.aiFailed': 'El lector d’IA no l’ha pogut llegir.', + 'assistant.attach.why.noText': 'No conté text llegible, segurament és un document escanejat.', + 'assistant.attach.why.nothingFound': 'No hi ha res que sembli una reserva.', + 'assistant.attach.ask': 'Què faig amb el fitxer?', + 'assistant.attach.chip.keep': 'Desa’l a Fitxers', + 'assistant.attach.chip.book': 'Crea una reserva a partir d’aquest fitxer', + 'assistant.attach.chip.attach': 'Adjunta’l a una reserva o a una despesa', + 'assistant.attach.chip.read': 'Què hi ha al fitxer?', + 'assistant.attach.chip.keepWithBooking': 'Desa el fitxer amb aquesta reserva', }; export default assistant; diff --git a/shared/src/i18n/cs/assistant.ts b/shared/src/i18n/cs/assistant.ts index 461f732a0..1427c3d09 100644 --- a/shared/src/i18n/cs/assistant.ts +++ b/shared/src/i18n/cs/assistant.ts @@ -494,5 +494,20 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': 'Poslat do chatu cesty', 'assistant.admin.chatgptShared': 'Sdílíš své vlastní předplatné ChatGPT se všemi na tomto serveru: jejich chaty se počítají do tvého tarifu. Ověř, že to tvůj tarif a podmínky OpenAI dovolují.', + 'assistant.attach.found': 'V souboru {name} jsem našel {count} rezervací. Ty, které chcete, přidejte níže.', + 'assistant.attach.found.one': 'V souboru {name} jsem našel {count} rezervaci. Pokud sedí, přidejte ji níže.', + 'assistant.attach.found.few': 'V souboru {name} jsem našel {count} rezervace. Ty, které chcete, přidejte níže.', + 'assistant.attach.none': 'V souboru {name} jsem nenašel žádnou rezervaci.', + 'assistant.attach.why.aiNotConfigured': + 'Čtení pomocí AI tu pro importy není nastavené, takže soubor prošla jen vlastní čtečka TREK.', + 'assistant.attach.why.aiFailed': 'Čtečka AI ho nedokázala přečíst.', + 'assistant.attach.why.noText': 'Neobsahuje žádný čitelný text, nejspíš jde o sken.', + 'assistant.attach.why.nothingFound': 'Nic v něm nevypadá jako rezervace.', + 'assistant.attach.ask': 'Co mám se souborem udělat?', + 'assistant.attach.chip.keep': 'Ulož ho do Souborů', + 'assistant.attach.chip.book': 'Vytvoř z něj rezervaci', + 'assistant.attach.chip.attach': 'Připoj ho k rezervaci nebo k výdaji', + 'assistant.attach.chip.read': 'Co je v souboru?', + 'assistant.attach.chip.keepWithBooking': 'Ulož soubor k této rezervaci', }; export default assistant; diff --git a/shared/src/i18n/de/assistant.ts b/shared/src/i18n/de/assistant.ts index 8b03eb81f..738624af6 100644 --- a/shared/src/i18n/de/assistant.ts +++ b/shared/src/i18n/de/assistant.ts @@ -476,5 +476,19 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': 'In den Trip-Chat senden', 'assistant.admin.chatgptShared': 'Du teilst dein eigenes ChatGPT-Abo mit allen auf diesem Server: Ihre Chats zählen gegen dein Kontingent. Prüfe, ob dein Abo und die Bedingungen von OpenAI das erlauben.', + 'assistant.attach.found': 'Ich habe {count} Buchungen in {name} gefunden. Füge unten die hinzu, die du willst.', + 'assistant.attach.found.one': 'Ich habe {count} Buchung in {name} gefunden. Füge sie unten hinzu, wenn sie stimmt.', + 'assistant.attach.none': 'Ich habe in {name} keine Buchung gefunden.', + 'assistant.attach.why.aiNotConfigured': + 'Das Lesen mit KI ist für Importe hier nicht eingerichtet, deshalb hat nur TREKs eigener Leser die Datei angesehen.', + 'assistant.attach.why.aiFailed': 'Der KI-Leser konnte die Datei nicht lesen.', + 'assistant.attach.why.noText': 'Sie enthält keinen lesbaren Text und ist wahrscheinlich ein Scan.', + 'assistant.attach.why.nothingFound': 'Nichts darin sieht nach einer Buchung aus.', + 'assistant.attach.ask': 'Was soll ich mit der Datei machen?', + 'assistant.attach.chip.keep': 'In Dateien ablegen', + 'assistant.attach.chip.book': 'Eine Buchung daraus anlegen', + 'assistant.attach.chip.attach': 'An eine Buchung oder Ausgabe hängen', + 'assistant.attach.chip.read': 'Was steht in der Datei?', + 'assistant.attach.chip.keepWithBooking': 'Datei bei dieser Buchung ablegen', }; export default assistant; diff --git a/shared/src/i18n/en/assistant.ts b/shared/src/i18n/en/assistant.ts index 950f457fb..786664d54 100644 --- a/shared/src/i18n/en/assistant.ts +++ b/shared/src/i18n/en/assistant.ts @@ -470,5 +470,19 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': 'Send to the trip chat', 'assistant.admin.chatgptShared': 'You share your own ChatGPT plan with everyone on this server: their chats count against your plan. Check that your plan and OpenAI’s terms allow this.', + 'assistant.attach.found': 'I found {count} bookings in {name}. Add the ones you want below.', + 'assistant.attach.found.one': 'I found {count} booking in {name}. Add it below if it looks right.', + 'assistant.attach.none': 'I could not find a booking in {name}.', + 'assistant.attach.why.aiNotConfigured': + 'AI reading is not set up for imports here, so only TREK’s own reader looked at it.', + 'assistant.attach.why.aiFailed': 'The AI reader could not read it.', + 'assistant.attach.why.noText': 'It holds no readable text, so it is most likely a scan.', + 'assistant.attach.why.nothingFound': 'Nothing in it reads like a booking.', + 'assistant.attach.ask': 'What should I do with the file?', + 'assistant.attach.chip.keep': 'Keep it in Files', + 'assistant.attach.chip.book': 'Create a booking from it', + 'assistant.attach.chip.attach': 'Attach it to a booking or an expense', + 'assistant.attach.chip.read': 'What is in the file?', + 'assistant.attach.chip.keepWithBooking': 'Keep the file with this booking', }; export default assistant; diff --git a/shared/src/i18n/es/assistant.ts b/shared/src/i18n/es/assistant.ts index 3c702288e..2da2de6fd 100644 --- a/shared/src/i18n/es/assistant.ts +++ b/shared/src/i18n/es/assistant.ts @@ -474,5 +474,19 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': 'Enviar al chat del viaje', 'assistant.admin.chatgptShared': 'Compartes tu propio plan de ChatGPT con todos en este servidor: sus chats cuentan contra tu plan. Comprueba que tu plan y las condiciones de OpenAI lo permiten.', + 'assistant.attach.found': 'He encontrado {count} reservas en {name}. Añade abajo las que quieras.', + 'assistant.attach.found.one': 'He encontrado {count} reserva en {name}. Añádela abajo si es correcta.', + 'assistant.attach.none': 'No he encontrado ninguna reserva en {name}.', + 'assistant.attach.why.aiNotConfigured': + 'La lectura con IA no está configurada para importaciones, así que solo lo revisó el lector propio de TREK.', + 'assistant.attach.why.aiFailed': 'El lector de IA no pudo leerlo.', + 'assistant.attach.why.noText': 'No contiene texto legible, probablemente es un escaneo.', + 'assistant.attach.why.nothingFound': 'Nada en él parece una reserva.', + 'assistant.attach.ask': '¿Qué hago con el archivo?', + 'assistant.attach.chip.keep': 'Guárdalo en Archivos', + 'assistant.attach.chip.book': 'Crea una reserva a partir de él', + 'assistant.attach.chip.attach': 'Adjúntalo a una reserva o a un gasto', + 'assistant.attach.chip.read': '¿Qué hay en el archivo?', + 'assistant.attach.chip.keepWithBooking': 'Guarda el archivo con esta reserva', }; export default assistant; diff --git a/shared/src/i18n/et/assistant.ts b/shared/src/i18n/et/assistant.ts index 1f3ce236f..8609fe695 100644 --- a/shared/src/i18n/et/assistant.ts +++ b/shared/src/i18n/et/assistant.ts @@ -475,5 +475,19 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': 'Saada reisivestlusesse', 'assistant.admin.chatgptShared': 'Jagad oma ChatGPT tellimust kõigiga selles serveris: nende vestlused arvestatakse sinu paketist. Kontrolli, kas sinu pakett ja OpenAI tingimused seda lubavad.', + 'assistant.attach.found': 'Leidsin failist {name} {count} broneeringut. Lisa allpool need, mida soovid.', + 'assistant.attach.found.one': 'Leidsin failist {name} {count} broneeringu. Lisa see allpool, kui see on õige.', + 'assistant.attach.none': 'Ma ei leidnud failist {name} ühtegi broneeringut.', + 'assistant.attach.why.aiNotConfigured': + 'Tehisintellektiga lugemine pole siin importide jaoks seadistatud, nii et faili vaatas ainult TREKi enda lugeja.', + 'assistant.attach.why.aiFailed': 'Tehisintellekti lugeja ei suutnud seda lugeda.', + 'assistant.attach.why.noText': 'Selles pole loetavat teksti, tõenäoliselt on see skaneering.', + 'assistant.attach.why.nothingFound': 'Miski selles ei näe välja nagu broneering.', + 'assistant.attach.ask': 'Mida ma failiga tegema pean?', + 'assistant.attach.chip.keep': 'Salvesta see failidesse', + 'assistant.attach.chip.book': 'Loo sellest broneering', + 'assistant.attach.chip.attach': 'Lisa see broneeringu või kulu juurde', + 'assistant.attach.chip.read': 'Mis failis on?', + 'assistant.attach.chip.keepWithBooking': 'Salvesta fail selle broneeringu juurde', }; export default assistant; diff --git a/shared/src/i18n/fr/assistant.ts b/shared/src/i18n/fr/assistant.ts index 987f21af9..a5a37d55f 100644 --- a/shared/src/i18n/fr/assistant.ts +++ b/shared/src/i18n/fr/assistant.ts @@ -480,5 +480,20 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': 'Envoyer dans la discussion du voyage', 'assistant.admin.chatgptShared': 'Vous partagez votre propre abonnement ChatGPT avec tout le monde sur ce serveur : leurs discussions comptent sur votre forfait. Vérifiez que votre forfait et les conditions d’OpenAI le permettent.', + 'assistant.attach.found': 'J’ai trouvé {count} réservations dans {name}. Ajoutez ci-dessous celles que vous voulez.', + 'assistant.attach.found.one': + 'J’ai trouvé {count} réservation dans {name}. Ajoutez-la ci-dessous si elle est correcte.', + 'assistant.attach.none': 'Je n’ai trouvé aucune réservation dans {name}.', + 'assistant.attach.why.aiNotConfigured': + 'La lecture par IA n’est pas configurée pour les imports ici, seul le lecteur intégré de TREK l’a donc examiné.', + 'assistant.attach.why.aiFailed': 'Le lecteur IA n’a pas pu le lire.', + 'assistant.attach.why.noText': 'Il ne contient aucun texte lisible, c’est sans doute un scan.', + 'assistant.attach.why.nothingFound': 'Rien dedans ne ressemble à une réservation.', + 'assistant.attach.ask': 'Que dois-je faire du fichier ?', + 'assistant.attach.chip.keep': 'Garde-le dans Fichiers', + 'assistant.attach.chip.book': 'Crée une réservation à partir de ce fichier', + 'assistant.attach.chip.attach': 'Joins-le à une réservation ou à une dépense', + 'assistant.attach.chip.read': 'Que contient le fichier ?', + 'assistant.attach.chip.keepWithBooking': 'Garde le fichier avec cette réservation', }; export default assistant; diff --git a/shared/src/i18n/gr/assistant.ts b/shared/src/i18n/gr/assistant.ts index d584ac51b..110f45310 100644 --- a/shared/src/i18n/gr/assistant.ts +++ b/shared/src/i18n/gr/assistant.ts @@ -479,5 +479,19 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': 'Αποστολή στη συνομιλία ταξιδιού', 'assistant.admin.chatgptShared': 'Μοιράζεσαι τη δική σου συνδρομή ChatGPT με όλους σε αυτόν τον διακομιστή: οι συνομιλίες τους χρεώνονται στο δικό σου πρόγραμμα. Έλεγξε ότι το πρόγραμμά σου και οι όροι της OpenAI το επιτρέπουν.', + 'assistant.attach.found': 'Βρήκα {count} κρατήσεις στο {name}. Πρόσθεσε παρακάτω όσες θέλεις.', + 'assistant.attach.found.one': 'Βρήκα {count} κράτηση στο {name}. Πρόσθεσέ την παρακάτω αν είναι σωστή.', + 'assistant.attach.none': 'Δεν βρήκα καμία κράτηση στο {name}.', + 'assistant.attach.why.aiNotConfigured': + 'Η ανάγνωση με ΤΝ δεν έχει ρυθμιστεί για εισαγωγές εδώ, οπότε το εξέτασε μόνο ο αναγνώστης του TREK.', + 'assistant.attach.why.aiFailed': 'Ο αναγνώστης ΤΝ δεν μπόρεσε να το διαβάσει.', + 'assistant.attach.why.noText': 'Δεν περιέχει αναγνώσιμο κείμενο, μάλλον είναι σάρωση.', + 'assistant.attach.why.nothingFound': 'Τίποτα σε αυτό δεν μοιάζει με κράτηση.', + 'assistant.attach.ask': 'Τι να κάνω με το αρχείο;', + 'assistant.attach.chip.keep': 'Αποθήκευσέ το στα Αρχεία', + 'assistant.attach.chip.book': 'Δημιούργησε κράτηση από αυτό', + 'assistant.attach.chip.attach': 'Επισύναψέ το σε κράτηση ή έξοδο', + 'assistant.attach.chip.read': 'Τι περιέχει το αρχείο;', + 'assistant.attach.chip.keepWithBooking': 'Κράτα το αρχείο με αυτή την κράτηση', }; export default assistant; diff --git a/shared/src/i18n/hu/assistant.ts b/shared/src/i18n/hu/assistant.ts index 5f4cbe733..e9e882e0e 100644 --- a/shared/src/i18n/hu/assistant.ts +++ b/shared/src/i18n/hu/assistant.ts @@ -479,5 +479,19 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': 'Küldés az utazási csevegésbe', 'assistant.admin.chatgptShared': 'A saját ChatGPT-előfizetésedet osztod meg mindenkivel ezen a szerveren: a csevegéseik a te keretedből fogynak. Ellenőrizd, hogy az előfizetésed és az OpenAI feltételei ezt megengedik-e.', + 'assistant.attach.found': '{count} foglalást találtam ebben: {name}. Add hozzá lent azokat, amelyeket szeretnél.', + 'assistant.attach.found.one': '{count} foglalást találtam ebben: {name}. Add hozzá lent, ha jónak tűnik.', + 'assistant.attach.none': 'Nem találtam foglalást ebben: {name}.', + 'assistant.attach.why.aiNotConfigured': + 'Az importáláshoz itt nincs beállítva a mesterséges intelligenciával történő olvasás, ezért csak a TREK saját olvasója nézte meg.', + 'assistant.attach.why.aiFailed': 'A mesterséges intelligencia olvasója nem tudta elolvasni.', + 'assistant.attach.why.noText': 'Nincs benne olvasható szöveg, valószínűleg szkennelt dokumentum.', + 'assistant.attach.why.nothingFound': 'Semmi sem hasonlít benne foglalásra.', + 'assistant.attach.ask': 'Mit kezdjek a fájllal?', + 'assistant.attach.chip.keep': 'Mentsd a Fájlok közé', + 'assistant.attach.chip.book': 'Készíts belőle foglalást', + 'assistant.attach.chip.attach': 'Csatold egy foglaláshoz vagy kiadáshoz', + 'assistant.attach.chip.read': 'Mi van a fájlban?', + 'assistant.attach.chip.keepWithBooking': 'Mentsd a fájlt ehhez a foglaláshoz', }; export default assistant; diff --git a/shared/src/i18n/id/assistant.ts b/shared/src/i18n/id/assistant.ts index ebe02207f..8a9ae7551 100644 --- a/shared/src/i18n/id/assistant.ts +++ b/shared/src/i18n/id/assistant.ts @@ -455,5 +455,18 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': 'Kirim ke obrolan perjalanan', 'assistant.admin.chatgptShared': 'Kamu membagikan paket ChatGPT milikmu kepada semua orang di server ini: obrolan mereka dihitung dari paketmu. Pastikan paketmu dan ketentuan OpenAI mengizinkannya.', + 'assistant.attach.found': 'Saya menemukan {count} pemesanan di {name}. Tambahkan yang Anda inginkan di bawah.', + 'assistant.attach.none': 'Saya tidak menemukan pemesanan di {name}.', + 'assistant.attach.why.aiNotConfigured': + 'Pembacaan dengan AI belum diatur untuk impor di sini, jadi hanya pembaca bawaan TREK yang memeriksanya.', + 'assistant.attach.why.aiFailed': 'Pembaca AI tidak dapat membacanya.', + 'assistant.attach.why.noText': 'Berkas ini tidak berisi teks yang dapat dibaca, kemungkinan besar hasil pindaian.', + 'assistant.attach.why.nothingFound': 'Tidak ada isinya yang tampak seperti pemesanan.', + 'assistant.attach.ask': 'Apa yang harus saya lakukan dengan berkas ini?', + 'assistant.attach.chip.keep': 'Simpan di Berkas', + 'assistant.attach.chip.book': 'Buat pemesanan darinya', + 'assistant.attach.chip.attach': 'Lampirkan ke pemesanan atau pengeluaran', + 'assistant.attach.chip.read': 'Apa isi berkas ini?', + 'assistant.attach.chip.keepWithBooking': 'Simpan berkas dengan pemesanan ini', }; export default assistant; diff --git a/shared/src/i18n/it/assistant.ts b/shared/src/i18n/it/assistant.ts index d5a3e6190..c4dffcb91 100644 --- a/shared/src/i18n/it/assistant.ts +++ b/shared/src/i18n/it/assistant.ts @@ -482,5 +482,19 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': 'Invia nella chat del viaggio', 'assistant.admin.chatgptShared': 'Condividi il tuo abbonamento ChatGPT con tutti su questo server: le loro chat contano sul tuo piano. Verifica che il tuo piano e i termini di OpenAI lo consentano.', + 'assistant.attach.found': 'Ho trovato {count} prenotazioni in {name}. Aggiungi qui sotto quelle che vuoi.', + 'assistant.attach.found.one': 'Ho trovato {count} prenotazione in {name}. Aggiungila qui sotto se è corretta.', + 'assistant.attach.none': 'Non ho trovato nessuna prenotazione in {name}.', + 'assistant.attach.why.aiNotConfigured': + 'La lettura con IA non è configurata per le importazioni, quindi l’ha esaminato solo il lettore di TREK.', + 'assistant.attach.why.aiFailed': 'Il lettore IA non è riuscito a leggerlo.', + 'assistant.attach.why.noText': 'Non contiene testo leggibile, probabilmente è una scansione.', + 'assistant.attach.why.nothingFound': 'Niente al suo interno sembra una prenotazione.', + 'assistant.attach.ask': 'Cosa devo fare con il file?', + 'assistant.attach.chip.keep': 'Salvalo in File', + 'assistant.attach.chip.book': 'Crea una prenotazione da questo file', + 'assistant.attach.chip.attach': 'Allegalo a una prenotazione o a una spesa', + 'assistant.attach.chip.read': 'Cosa c’è nel file?', + 'assistant.attach.chip.keepWithBooking': 'Salva il file con questa prenotazione', }; export default assistant; diff --git a/shared/src/i18n/ja/assistant.ts b/shared/src/i18n/ja/assistant.ts index b96c35220..333158f4d 100644 --- a/shared/src/i18n/ja/assistant.ts +++ b/shared/src/i18n/ja/assistant.ts @@ -449,5 +449,18 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': '旅行チャットに送信', 'assistant.admin.chatgptShared': '自分の ChatGPT プランをこのサーバーの全員と共有します。全員のチャットがあなたのプランの利用枠を使います。プランと OpenAI の規約で許可されているか確認してください。', + 'assistant.attach.found': '{name} に予約が {count} 件見つかりました。必要なものを下で追加してください。', + 'assistant.attach.none': '{name} に予約は見つかりませんでした。', + 'assistant.attach.why.aiNotConfigured': + 'ここではインポート用の AI 読み取りが設定されていないため、TREK 独自の読み取りだけで確認しました。', + 'assistant.attach.why.aiFailed': 'AI の読み取りでファイルを読めませんでした。', + 'assistant.attach.why.noText': '読み取れるテキストがありません。スキャンした画像の可能性が高いです。', + 'assistant.attach.why.nothingFound': '予約らしき内容は含まれていません。', + 'assistant.attach.ask': 'このファイルをどうしますか?', + 'assistant.attach.chip.keep': 'ファイルに保存して', + 'assistant.attach.chip.book': 'このファイルから予約を作って', + 'assistant.attach.chip.attach': '予約か支出に添付して', + 'assistant.attach.chip.read': 'ファイルの中身は?', + 'assistant.attach.chip.keepWithBooking': 'このファイルをこの予約と一緒に保存して', }; export default assistant; diff --git a/shared/src/i18n/ko/assistant.ts b/shared/src/i18n/ko/assistant.ts index da59ad744..2b393de75 100644 --- a/shared/src/i18n/ko/assistant.ts +++ b/shared/src/i18n/ko/assistant.ts @@ -446,5 +446,18 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': '여행 채팅으로 보내기', 'assistant.admin.chatgptShared': '내 ChatGPT 요금제를 이 서버의 모든 사람과 공유합니다. 모든 사람의 채팅이 내 요금제 한도에서 차감됩니다. 요금제와 OpenAI 약관에서 허용되는지 확인하세요.', + 'assistant.attach.found': '{name}에서 예약 {count}건을 찾았습니다. 원하는 예약을 아래에서 추가하세요.', + 'assistant.attach.none': '{name}에서 예약을 찾지 못했습니다.', + 'assistant.attach.why.aiNotConfigured': + '이곳에는 가져오기용 AI 읽기가 설정되어 있지 않아 TREK 자체 리더만 파일을 확인했습니다.', + 'assistant.attach.why.aiFailed': 'AI 리더가 파일을 읽지 못했습니다.', + 'assistant.attach.why.noText': '읽을 수 있는 텍스트가 없습니다. 스캔한 문서일 가능성이 큽니다.', + 'assistant.attach.why.nothingFound': '예약처럼 보이는 내용이 없습니다.', + 'assistant.attach.ask': '이 파일을 어떻게 할까요?', + 'assistant.attach.chip.keep': '파일에 보관해 줘', + 'assistant.attach.chip.book': '이 파일로 예약을 만들어 줘', + 'assistant.attach.chip.attach': '예약이나 지출에 첨부해 줘', + 'assistant.attach.chip.read': '파일에 무엇이 있어?', + 'assistant.attach.chip.keepWithBooking': '이 예약과 함께 파일을 보관해 줘', }; export default assistant; diff --git a/shared/src/i18n/nl/assistant.ts b/shared/src/i18n/nl/assistant.ts index 8dcde6137..ffc634c00 100644 --- a/shared/src/i18n/nl/assistant.ts +++ b/shared/src/i18n/nl/assistant.ts @@ -477,5 +477,19 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': 'Naar de reischat sturen', 'assistant.admin.chatgptShared': 'Je deelt je eigen ChatGPT-abonnement met iedereen op deze server: hun chats tellen mee voor jouw abonnement. Controleer of je abonnement en de voorwaarden van OpenAI dit toestaan.', + 'assistant.attach.found': 'Ik heb {count} boekingen gevonden in {name}. Voeg hieronder toe wat je wilt.', + 'assistant.attach.found.one': 'Ik heb {count} boeking gevonden in {name}. Voeg die hieronder toe als hij klopt.', + 'assistant.attach.none': 'Ik heb geen boeking gevonden in {name}.', + 'assistant.attach.why.aiNotConfigured': + 'Lezen met AI is hier niet ingesteld voor imports, dus alleen de eigen lezer van TREK heeft ernaar gekeken.', + 'assistant.attach.why.aiFailed': 'De AI-lezer kon het niet lezen.', + 'assistant.attach.why.noText': 'Er staat geen leesbare tekst in, het is waarschijnlijk een scan.', + 'assistant.attach.why.nothingFound': 'Niets erin lijkt op een boeking.', + 'assistant.attach.ask': 'Wat moet ik met het bestand doen?', + 'assistant.attach.chip.keep': 'Bewaar het in Bestanden', + 'assistant.attach.chip.book': 'Maak er een boeking van', + 'assistant.attach.chip.attach': 'Koppel het aan een boeking of een uitgave', + 'assistant.attach.chip.read': 'Wat staat er in het bestand?', + 'assistant.attach.chip.keepWithBooking': 'Bewaar het bestand bij deze boeking', }; export default assistant; diff --git a/shared/src/i18n/pl/assistant.ts b/shared/src/i18n/pl/assistant.ts index 56c6454d8..6a9e8e438 100644 --- a/shared/src/i18n/pl/assistant.ts +++ b/shared/src/i18n/pl/assistant.ts @@ -518,5 +518,21 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': 'Wyślij na czat podróży', 'assistant.admin.chatgptShared': 'Udostępniasz własny plan ChatGPT wszystkim na tym serwerze: ich czaty liczą się do twojego planu. Sprawdź, czy twój plan i warunki OpenAI na to pozwalają.', + 'assistant.attach.found': 'Znalazłem w pliku {name} {count} rezerwacji. Dodaj poniżej te, które chcesz.', + 'assistant.attach.found.one': 'Znalazłem w pliku {name} {count} rezerwację. Dodaj ją poniżej, jeśli się zgadza.', + 'assistant.attach.found.few': 'Znalazłem w pliku {name} {count} rezerwacje. Dodaj poniżej te, które chcesz.', + 'assistant.attach.found.many': 'Znalazłem w pliku {name} {count} rezerwacji. Dodaj poniżej te, które chcesz.', + 'assistant.attach.none': 'Nie znalazłem żadnej rezerwacji w pliku {name}.', + 'assistant.attach.why.aiNotConfigured': + 'Odczyt przez AI nie jest tu skonfigurowany dla importów, więc plik sprawdził tylko własny czytnik TREK.', + 'assistant.attach.why.aiFailed': 'Czytnik AI nie zdołał go odczytać.', + 'assistant.attach.why.noText': 'Nie zawiera czytelnego tekstu, to najpewniej skan.', + 'assistant.attach.why.nothingFound': 'Nic w nim nie wygląda na rezerwację.', + 'assistant.attach.ask': 'Co mam zrobić z plikiem?', + 'assistant.attach.chip.keep': 'Zapisz go w Plikach', + 'assistant.attach.chip.book': 'Utwórz z niego rezerwację', + 'assistant.attach.chip.attach': 'Dołącz go do rezerwacji lub wydatku', + 'assistant.attach.chip.read': 'Co jest w pliku?', + 'assistant.attach.chip.keepWithBooking': 'Zapisz plik przy tej rezerwacji', }; export default assistant; diff --git a/shared/src/i18n/ru/assistant.ts b/shared/src/i18n/ru/assistant.ts index 1b84c7dea..d2e5e1e02 100644 --- a/shared/src/i18n/ru/assistant.ts +++ b/shared/src/i18n/ru/assistant.ts @@ -519,5 +519,21 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': 'Отправить в чат поездки', 'assistant.admin.chatgptShared': 'Вы делитесь своей подпиской ChatGPT со всеми на этом сервере: их чаты расходуют ваш лимит. Проверьте, что ваш тариф и условия OpenAI это допускают.', + 'assistant.attach.found': 'Я нашёл в файле {name} {count} бронирования. Добавьте ниже те, что нужны.', + 'assistant.attach.found.one': 'Я нашёл в файле {name} {count} бронирование. Добавьте его ниже, если всё верно.', + 'assistant.attach.found.few': 'Я нашёл в файле {name} {count} бронирования. Добавьте ниже те, что нужны.', + 'assistant.attach.found.many': 'Я нашёл в файле {name} {count} бронирований. Добавьте ниже те, что нужны.', + 'assistant.attach.none': 'Я не нашёл в файле {name} ни одного бронирования.', + 'assistant.attach.why.aiNotConfigured': + 'Чтение с помощью ИИ для импорта здесь не настроено, поэтому файл просмотрел только собственный модуль чтения TREK.', + 'assistant.attach.why.aiFailed': 'Модулю чтения ИИ не удалось его прочитать.', + 'assistant.attach.why.noText': 'В нём нет читаемого текста, скорее всего это скан.', + 'assistant.attach.why.nothingFound': 'Ничто в нём не похоже на бронирование.', + 'assistant.attach.ask': 'Что мне сделать с файлом?', + 'assistant.attach.chip.keep': 'Сохрани его в Файлы', + 'assistant.attach.chip.book': 'Создай из него бронирование', + 'assistant.attach.chip.attach': 'Прикрепи его к бронированию или расходу', + 'assistant.attach.chip.read': 'Что в этом файле?', + 'assistant.attach.chip.keepWithBooking': 'Сохрани файл вместе с этим бронированием', }; export default assistant; diff --git a/shared/src/i18n/sk/assistant.ts b/shared/src/i18n/sk/assistant.ts index bb36856ad..230d04c5a 100644 --- a/shared/src/i18n/sk/assistant.ts +++ b/shared/src/i18n/sk/assistant.ts @@ -494,5 +494,20 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': 'Poslať do chatu cesty', 'assistant.admin.chatgptShared': 'Zdieľaš svoje vlastné predplatné ChatGPT so všetkými na tomto serveri: ich chaty sa počítajú do tvojho plánu. Over, že to tvoj plán a podmienky OpenAI dovoľujú.', + 'assistant.attach.found': 'V súbore {name} som našiel {count} rezervácií. Tie, ktoré chcete, pridajte nižšie.', + 'assistant.attach.found.one': 'V súbore {name} som našiel {count} rezerváciu. Ak sedí, pridajte ju nižšie.', + 'assistant.attach.found.few': 'V súbore {name} som našiel {count} rezervácie. Tie, ktoré chcete, pridajte nižšie.', + 'assistant.attach.none': 'V súbore {name} som nenašiel žiadnu rezerváciu.', + 'assistant.attach.why.aiNotConfigured': + 'Čítanie pomocou AI tu pre importy nie je nastavené, preto súbor prešla len vlastná čítačka TREK.', + 'assistant.attach.why.aiFailed': 'Čítačka AI ho nedokázala prečítať.', + 'assistant.attach.why.noText': 'Neobsahuje čitateľný text, pravdepodobne ide o sken.', + 'assistant.attach.why.nothingFound': 'Nič v ňom nevyzerá ako rezervácia.', + 'assistant.attach.ask': 'Čo mám so súborom urobiť?', + 'assistant.attach.chip.keep': 'Ulož ho do Súborov', + 'assistant.attach.chip.book': 'Vytvor z neho rezerváciu', + 'assistant.attach.chip.attach': 'Pripoj ho k rezervácii alebo k výdavku', + 'assistant.attach.chip.read': 'Čo je v súbore?', + 'assistant.attach.chip.keepWithBooking': 'Ulož súbor k tejto rezervácii', }; export default assistant; diff --git a/shared/src/i18n/sv/assistant.ts b/shared/src/i18n/sv/assistant.ts index fff321d56..016036910 100644 --- a/shared/src/i18n/sv/assistant.ts +++ b/shared/src/i18n/sv/assistant.ts @@ -475,5 +475,19 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': 'Skicka till reschatten', 'assistant.admin.chatgptShared': 'Du delar ditt eget ChatGPT-abonnemang med alla på den här servern: deras chattar räknas mot ditt abonnemang. Kontrollera att ditt abonnemang och OpenAIs villkor tillåter det.', + 'assistant.attach.found': 'Jag hittade {count} bokningar i {name}. Lägg till de du vill ha nedan.', + 'assistant.attach.found.one': 'Jag hittade {count} bokning i {name}. Lägg till den nedan om den stämmer.', + 'assistant.attach.none': 'Jag hittade ingen bokning i {name}.', + 'assistant.attach.why.aiNotConfigured': + 'AI-läsning är inte inställd för importer här, så bara TREKs egen läsare tittade på filen.', + 'assistant.attach.why.aiFailed': 'AI-läsaren kunde inte läsa den.', + 'assistant.attach.why.noText': 'Den innehåller ingen läsbar text, troligen är det en skanning.', + 'assistant.attach.why.nothingFound': 'Inget i den ser ut som en bokning.', + 'assistant.attach.ask': 'Vad ska jag göra med filen?', + 'assistant.attach.chip.keep': 'Spara den i Filer', + 'assistant.attach.chip.book': 'Skapa en bokning av den', + 'assistant.attach.chip.attach': 'Bifoga den till en bokning eller en utgift', + 'assistant.attach.chip.read': 'Vad står det i filen?', + 'assistant.attach.chip.keepWithBooking': 'Spara filen med den här bokningen', }; export default assistant; diff --git a/shared/src/i18n/th/assistant.ts b/shared/src/i18n/th/assistant.ts index 17a5e1659..877ce7216 100644 --- a/shared/src/i18n/th/assistant.ts +++ b/shared/src/i18n/th/assistant.ts @@ -447,5 +447,18 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': 'ส่งไปยังแชตทริป', 'assistant.admin.chatgptShared': 'คุณกำลังแชร์แพ็กเกจ ChatGPT ของตัวเองกับทุกคนบนเซิร์ฟเวอร์นี้: แชตของทุกคนจะนับรวมในแพ็กเกจของคุณ ตรวจสอบว่าแพ็กเกจและข้อกำหนดของ OpenAI อนุญาต', + 'assistant.attach.found': 'ฉันพบการจอง {count} รายการใน {name} เพิ่มรายการที่ต้องการได้ด้านล่าง', + 'assistant.attach.none': 'ฉันไม่พบการจองใน {name}', + 'assistant.attach.why.aiNotConfigured': + 'ที่นี่ยังไม่ได้ตั้งค่าการอ่านด้วย AI สำหรับการนำเข้า จึงมีเพียงตัวอ่านของ TREK ที่ตรวจไฟล์นี้', + 'assistant.attach.why.aiFailed': 'ตัวอ่าน AI อ่านไฟล์นี้ไม่ได้', + 'assistant.attach.why.noText': 'ไฟล์นี้ไม่มีข้อความที่อ่านได้ น่าจะเป็นไฟล์สแกน', + 'assistant.attach.why.nothingFound': 'ไม่มีส่วนใดในไฟล์ที่ดูเหมือนการจอง', + 'assistant.attach.ask': 'ให้ฉันทำอะไรกับไฟล์นี้ดี', + 'assistant.attach.chip.keep': 'เก็บไว้ในไฟล์', + 'assistant.attach.chip.book': 'สร้างการจองจากไฟล์นี้', + 'assistant.attach.chip.attach': 'แนบกับการจองหรือค่าใช้จ่าย', + 'assistant.attach.chip.read': 'ในไฟล์มีอะไรบ้าง', + 'assistant.attach.chip.keepWithBooking': 'เก็บไฟล์ไว้กับการจองนี้', }; export default assistant; diff --git a/shared/src/i18n/tr/assistant.ts b/shared/src/i18n/tr/assistant.ts index 54a002332..4b58afaca 100644 --- a/shared/src/i18n/tr/assistant.ts +++ b/shared/src/i18n/tr/assistant.ts @@ -475,5 +475,19 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': 'Gezi sohbetine gönder', 'assistant.admin.chatgptShared': 'Kendi ChatGPT aboneliğini bu sunucudaki herkesle paylaşıyorsun: sohbetleri senin planından düşer. Planının ve OpenAI koşullarının buna izin verip vermediğini kontrol et.', + 'assistant.attach.found': '{name} içinde {count} rezervasyon buldum. İstediklerini aşağıdan ekle.', + 'assistant.attach.found.one': '{name} içinde {count} rezervasyon buldum. Doğru görünüyorsa aşağıdan ekle.', + 'assistant.attach.none': '{name} içinde rezervasyon bulamadım.', + 'assistant.attach.why.aiNotConfigured': + 'Burada içe aktarma için yapay zekâ ile okuma ayarlı değil, bu yüzden dosyaya yalnızca TREK’in kendi okuyucusu baktı.', + 'assistant.attach.why.aiFailed': 'Yapay zekâ okuyucusu dosyayı okuyamadı.', + 'assistant.attach.why.noText': 'Okunabilir metin içermiyor, büyük olasılıkla taranmış bir belge.', + 'assistant.attach.why.nothingFound': 'İçinde rezervasyona benzeyen bir şey yok.', + 'assistant.attach.ask': 'Dosyayla ne yapayım?', + 'assistant.attach.chip.keep': 'Dosyalar’a kaydet', + 'assistant.attach.chip.book': 'Bundan bir rezervasyon oluştur', + 'assistant.attach.chip.attach': 'Bir rezervasyona veya harcamaya ekle', + 'assistant.attach.chip.read': 'Dosyada ne var?', + 'assistant.attach.chip.keepWithBooking': 'Dosyayı bu rezervasyonla sakla', }; export default assistant; diff --git a/shared/src/i18n/uk/assistant.ts b/shared/src/i18n/uk/assistant.ts index f6ed064a1..79e73024c 100644 --- a/shared/src/i18n/uk/assistant.ts +++ b/shared/src/i18n/uk/assistant.ts @@ -517,5 +517,21 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': 'Надіслати в чат подорожі', 'assistant.admin.chatgptShared': 'Ви ділитеся своєю підпискою ChatGPT з усіма на цьому сервері: їхні чати витрачають ваш ліміт. Перевірте, що ваш тариф і умови OpenAI це дозволяють.', + 'assistant.attach.found': 'Я знайшов у файлі {name} {count} бронювання. Додайте нижче ті, що потрібні.', + 'assistant.attach.found.one': 'Я знайшов у файлі {name} {count} бронювання. Додайте його нижче, якщо все правильно.', + 'assistant.attach.found.few': 'Я знайшов у файлі {name} {count} бронювання. Додайте нижче ті, що потрібні.', + 'assistant.attach.found.many': 'Я знайшов у файлі {name} {count} бронювань. Додайте нижче ті, що потрібні.', + 'assistant.attach.none': 'Я не знайшов у файлі {name} жодного бронювання.', + 'assistant.attach.why.aiNotConfigured': + 'Читання за допомогою ШІ для імпорту тут не налаштовано, тому файл переглянув лише власний модуль читання TREK.', + 'assistant.attach.why.aiFailed': 'Модулю читання ШІ не вдалося його прочитати.', + 'assistant.attach.why.noText': 'У ньому немає тексту, який можна прочитати, найімовірніше це скан.', + 'assistant.attach.why.nothingFound': 'Ніщо в ньому не схоже на бронювання.', + 'assistant.attach.ask': 'Що мені зробити з файлом?', + 'assistant.attach.chip.keep': 'Збережи його у Файлах', + 'assistant.attach.chip.book': 'Створи з нього бронювання', + 'assistant.attach.chip.attach': 'Прикріпи його до бронювання або витрати', + 'assistant.attach.chip.read': 'Що в цьому файлі?', + 'assistant.attach.chip.keepWithBooking': 'Збережи файл разом із цим бронюванням', }; export default assistant; diff --git a/shared/src/i18n/vi/assistant.ts b/shared/src/i18n/vi/assistant.ts index e9a33a0af..0f454257a 100644 --- a/shared/src/i18n/vi/assistant.ts +++ b/shared/src/i18n/vi/assistant.ts @@ -450,5 +450,18 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': 'Gửi vào trò chuyện chuyến đi', 'assistant.admin.chatgptShared': 'Bạn đang chia sẻ gói ChatGPT của riêng mình với mọi người trên máy chủ này: các cuộc trò chuyện của họ được tính vào gói của bạn. Hãy kiểm tra gói của bạn và điều khoản của OpenAI có cho phép không.', + 'assistant.attach.found': 'Tôi tìm thấy {count} đặt chỗ trong {name}. Hãy thêm những đặt chỗ bạn muốn ở bên dưới.', + 'assistant.attach.none': 'Tôi không tìm thấy đặt chỗ nào trong {name}.', + 'assistant.attach.why.aiNotConfigured': + 'Việc đọc bằng AI cho nhập dữ liệu chưa được thiết lập ở đây, nên chỉ trình đọc riêng của TREK đã xem tệp.', + 'assistant.attach.why.aiFailed': 'Trình đọc AI không đọc được tệp.', + 'assistant.attach.why.noText': 'Tệp không có văn bản đọc được, nhiều khả năng là bản quét.', + 'assistant.attach.why.nothingFound': 'Không có gì trong tệp trông giống một đặt chỗ.', + 'assistant.attach.ask': 'Tôi nên làm gì với tệp này?', + 'assistant.attach.chip.keep': 'Lưu vào Tệp', + 'assistant.attach.chip.book': 'Tạo đặt chỗ từ tệp này', + 'assistant.attach.chip.attach': 'Đính kèm vào một đặt chỗ hoặc khoản chi', + 'assistant.attach.chip.read': 'Trong tệp có gì?', + 'assistant.attach.chip.keepWithBooking': 'Lưu tệp cùng đặt chỗ này', }; export default assistant; diff --git a/shared/src/i18n/zh-TW/assistant.ts b/shared/src/i18n/zh-TW/assistant.ts index 7737d3e75..bb46006fc 100644 --- a/shared/src/i18n/zh-TW/assistant.ts +++ b/shared/src/i18n/zh-TW/assistant.ts @@ -442,5 +442,17 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': '傳送到行程聊天', 'assistant.admin.chatgptShared': '你正在與此伺服器上的所有人共用你自己的 ChatGPT 訂閱:他們的聊天會計入你的方案。請確認你的方案和 OpenAI 的條款允許這樣做。', + 'assistant.attach.found': '我在 {name} 中找到 {count} 筆預訂。請在下方新增你需要的預訂。', + 'assistant.attach.none': '我在 {name} 中找不到預訂。', + 'assistant.attach.why.aiNotConfigured': '這裡沒有為匯入設定 AI 讀取,所以只有 TREK 內建的讀取器查看了這個檔案。', + 'assistant.attach.why.aiFailed': 'AI 讀取器無法讀取這個檔案。', + 'assistant.attach.why.noText': '檔案裡沒有可讀取的文字,很可能是掃描檔。', + 'assistant.attach.why.nothingFound': '檔案裡沒有像預訂的內容。', + 'assistant.attach.ask': '這個檔案要怎麼處理?', + 'assistant.attach.chip.keep': '儲存到檔案', + 'assistant.attach.chip.book': '用它建立一筆預訂', + 'assistant.attach.chip.attach': '附加到某筆預訂或支出', + 'assistant.attach.chip.read': '檔案裡有什麼?', + 'assistant.attach.chip.keepWithBooking': '把檔案和這筆預訂放在一起', }; export default assistant; diff --git a/shared/src/i18n/zh/assistant.ts b/shared/src/i18n/zh/assistant.ts index 61678429a..37c5f5332 100644 --- a/shared/src/i18n/zh/assistant.ts +++ b/shared/src/i18n/zh/assistant.ts @@ -442,5 +442,17 @@ const assistant: TranslationStrings = { 'assistant.tool.send_collab_message': '发送到行程聊天', 'assistant.admin.chatgptShared': '你正在与此服务器上的所有人共享你自己的 ChatGPT 订阅:他们的聊天会计入你的套餐。请确认你的套餐和 OpenAI 的条款允许这样做。', + 'assistant.attach.found': '我在 {name} 中找到 {count} 个预订。请在下方添加你需要的预订。', + 'assistant.attach.none': '我在 {name} 中没有找到预订。', + 'assistant.attach.why.aiNotConfigured': '这里没有为导入设置 AI 读取,所以只有 TREK 自带的读取器查看了这个文件。', + 'assistant.attach.why.aiFailed': 'AI 读取器无法读取这个文件。', + 'assistant.attach.why.noText': '文件里没有可读取的文字,很可能是扫描件。', + 'assistant.attach.why.nothingFound': '文件里没有像预订的内容。', + 'assistant.attach.ask': '这个文件要怎么处理?', + 'assistant.attach.chip.keep': '保存到文件', + 'assistant.attach.chip.book': '用它创建一个预订', + 'assistant.attach.chip.attach': '附加到某个预订或支出', + 'assistant.attach.chip.read': '文件里有什么?', + 'assistant.attach.chip.keepWithBooking': '把文件和这个预订放在一起', }; export default assistant;