reworked the input type for more flexibility

This commit is contained in:
Matthias Puchstein
2025-07-06 17:19:36 +02:00
parent 84a72d5354
commit 62a2ff03dd
4 changed files with 131 additions and 92 deletions

View File

@@ -1,10 +1,27 @@
export type TextInput = {
inputType: "text";
input: string;
}
export type ImageInput = {
inputType: "image";
img: string;
imgAlt: string;
description: string;
}
export type AudioInput = {
inputType: "audio";
audio: string;
transcript: string;
}
export default class Dream{
id: number;
userId: number;
title: string;
date: Date;
inputType: "text" | "image" | "audio" ;
input: string;
input: TextInput | ImageInput | AudioInput;
ai?:{
interpretation: string;
image?: string;
@@ -18,8 +35,7 @@ export default class Dream{
userId: number;
title: string;
date: Date;
inputType: "text" | "image" | "audio" ;
input: string;
input: TextInput | ImageInput | AudioInput;
ai: {
interpretation: string;
image?: string;
@@ -32,7 +48,6 @@ export default class Dream{
this.userId = params.userId;
this.title = params.title;
this.date = params.date;
this.inputType = params.inputType;
this.input = params.input;
this.ai= params.ai;
}