Skip to content

Commit

Permalink
refactor(types): improve type safety in TreeItem and WebviewMessage i…
Browse files Browse the repository at this point in the history
…nterfaces

- Updated TreeItem interface to use a more specific type for the value property.
- Used string literal types for command, provider, and model properties in WebviewMessage interface for better type safety and autocomplete support.
  • Loading branch information
wyennie committed Sep 24, 2024
1 parent b452a16 commit 37b1f7d
Showing 1 changed file with 35 additions and 4 deletions.
39 changes: 35 additions & 4 deletions src/types/ChatTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface ChatMessage {

export interface TreeItem {
name: string;
value?: string;
value?: string | number;
children?: TreeItem[];
title?: string;
hidden?: boolean;
Expand All @@ -27,9 +27,40 @@ export interface TreeItem {
}

export interface WebviewMessage {
command: string;
command: 'sendMessage' | 'clearChat' | 'showInfo' | 'updateProvider' | 'updateModel' | 'prevPage' | 'nextPage';
text?: string;
context?: string[];
provider?: string;
model?: string;
provider?: 'openai' | 'anthropic' | 'gemini';
model?: | 'gemini-1.5-pro'
| 'gemini-1.5-flash'
| 'gemini-1.0-pro'
| 'gpt-4o'
| 'gpt-4o-mini'
| 'gpt-4o-2024-05-13'
| 'gpt-4-turbo'
| 'gpt-4-turbo-2024-04-09'
| 'gpt-4-0125-preview'
| 'gpt-4-turbo-preview'
| 'gpt-4-1106-preview'
| 'gpt-4-vision-preview'
| 'gpt-4'
| 'gpt-4-0314'
| 'gpt-4-0613'
| 'gpt-4-32k'
| 'gpt-4-32k-0314'
| 'gpt-4-32k-0613'
| 'gpt-3.5-turbo'
| 'gpt-3.5-turbo-16k'
| 'gpt-3.5-turbo-0301'
| 'gpt-3.5-turbo-0613'
| 'gpt-3.5-turbo-1106'
| 'gpt-3.5-turbo-0125'
| 'gpt-3.5-turbo-16k-0613'
| 'claude-3-5-sonnet-20240620'
| 'claude-3-opus-20240229'
| 'claude-3-sonnet-20240229'
| 'claude-3-haiku-20240307'
| 'claude-2.1'
| 'claude-2.0'
| 'claude-instant-1.2';
}

0 comments on commit 37b1f7d

Please sign in to comment.