mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-23 07:26:30 +00:00
d24db65cb8
- the assistant keeps facts for a trip (remember_for_trip) as a change card, applied into the user's trip notes; existing expenses can be changed - change card fields as a few icon chips with the rest folded under Details, the day band marks only what changes, the week grid as compact tiles - no map button on receipts of things that have no place on the map - tests follow the composer's accessible name, the receipt's status icon and the GL map's container; the hanging stream helper honours an early abort - Postgres probe: qualified columns in the upsert updates; entities restored to the generator's output; strict ratchet reads the SDK client as untyped
40 lines
1.5 KiB
TypeScript
40 lines
1.5 KiB
TypeScript
import { Collection, EntityRepositoryType, type Opt, type Ref, defineEntity, p } from '@mikro-orm/core';
|
|
import { AssistantMessagesRepository } from '../repositories/AssistantMessages.repository';
|
|
import { DbTimestampType } from '../types';
|
|
import { AssistantThreads } from './AssistantThreads.entity';
|
|
import { AssistantToolCalls } from './AssistantToolCalls.entity';
|
|
|
|
export class AssistantMessages {
|
|
[EntityRepositoryType]?: AssistantMessagesRepository;
|
|
id!: number & Opt;
|
|
thread!: Ref<AssistantThreads>;
|
|
thread_id!: number;
|
|
role!: string;
|
|
parts!: string;
|
|
provider_state?: string | null;
|
|
status: string & Opt = 'complete';
|
|
model?: string | null;
|
|
created_at!: string & Opt;
|
|
assistant_tool_calls_collection = new Collection<AssistantToolCalls>(this);
|
|
}
|
|
|
|
export const AssistantMessagesSchema = defineEntity({
|
|
class: AssistantMessages,
|
|
repository: () => AssistantMessagesRepository,
|
|
indexes: [
|
|
{ name: 'idx_assistant_messages_thread', properties: ['thread_id', 'id'] },
|
|
],
|
|
properties: {
|
|
id: p.integer().primary(),
|
|
thread: () => p.manyToOne(AssistantThreads).ref().deleteRule('cascade').hidden(),
|
|
thread_id: p.integer().persist(false),
|
|
role: p.text(),
|
|
parts: p.text(),
|
|
provider_state: p.text().nullable(),
|
|
status: p.text().default('complete'),
|
|
model: p.text().nullable(),
|
|
created_at: p.type(DbTimestampType).defaultRaw(`CURRENT_TIMESTAMP`),
|
|
assistant_tool_calls_collection: () => p.oneToMany(AssistantToolCalls).mappedBy('message').hidden(),
|
|
},
|
|
});
|