All files / src/llm-responses/dto sync-conversation.dto.ts

93.33% Statements 14/15
100% Branches 0/0
0% Functions 0/1
93.33% Lines 14/15

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 796x                 6x 6x           6x             6x         6x             6x     6x       6x         6x               6x               6x             6x           6x    
import {
  IsString,
  IsNotEmpty,
  IsArray,
  ValidateNested,
  IsOptional,
  IsIn,
  IsUrl,
} from 'class-validator';
import { Type } from 'class-transformer';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
 
class TurnDto {
  @ApiProperty({ description: 'Unique ID for this turn' })
  @IsString()
  @IsNotEmpty()
  id: string;
 
  @ApiProperty({
    description: 'Role of the message sender',
    enum: ['user', 'model'],
  })
  @IsIn(['user', 'model'])
  role: 'user' | 'model';
 
  @ApiProperty({ description: 'Content text of the turn' })
  @IsString()
  @IsNotEmpty()
  content: string;
 
  @ApiPropertyOptional({
    description: 'Thinking/reasoning content (for models that support it)',
  })
  @IsOptional()
  @IsString()
  thoughts?: string;
}
 
export class SyncConversationDto {
  @ApiPropertyOptional({ description: 'Existing conversation ID to sync to' })
  @IsOptional()
  @IsString()
  id?: string;
 
  @ApiProperty({ description: 'Title of the conversation' })
  @IsString()
  @IsNotEmpty()
  title: string;
 
  @ApiProperty({
    description: 'Model identifier used for this conversation',
    example: 'gemini-2.0-flash',
  })
  @IsString()
  @IsNotEmpty()
  model: string;
 
  @ApiPropertyOptional({
    description: 'URL of the external session',
    example: 'https://aistudio.google.com/chat/abc123',
  })
  @IsOptional()
  @IsUrl()
  session_url?: string;
 
  @ApiPropertyOptional({
    description: 'Raw request body from external source (for debugging)',
  })
  @IsOptional()
  @IsArray()
  rawRequestBody?: any;
 
  @ApiProperty({ description: 'Array of conversation turns', type: [TurnDto] })
  @IsArray()
  @ValidateNested({ each: true })
  @Type(() => TurnDto)
  turns: TurnDto[];
}