Add Kodu provider

This commit is contained in:
Saoud Rizwan
2024-08-24 09:18:27 -04:00
parent cc9637e0fe
commit df4e8e7afc
19 changed files with 380 additions and 305 deletions

View File

@@ -2,13 +2,17 @@
import { ApiConfiguration } from "./api"
import { HistoryItem } from "./HistoryItem"
import { MaestroUser } from "./maestro"
// webview will hold state
export interface ExtensionMessage {
type: "action" | "state" | "selectedImages"
text?: string
action?: "chatButtonTapped" | "settingsButtonTapped" | "historyButtonTapped" | "didBecomeVisible"
action?:
| "chatButtonTapped"
| "settingsButtonTapped"
| "historyButtonTapped"
| "didBecomeVisible"
| "koduCreditsFetched"
state?: ExtensionState
images?: string[]
}
@@ -22,7 +26,7 @@ export interface ExtensionState {
claudeMessages: ClaudeMessage[]
taskHistory: HistoryItem[]
shouldShowAnnouncement: boolean
maestroUser?: MaestroUser
koduCredits?: number
}
export interface ClaudeMessage {

View File

@@ -15,8 +15,10 @@ export interface WebviewMessage {
| "showTaskWithId"
| "deleteTaskWithId"
| "exportTaskWithId"
| "didClickMaestroSignIn"
| "didClickMaestroSignOut"
| "didClickKoduSignIn"
| "didClickKoduSignOut"
| "didClickKoduAddCredits"
| "fetchKoduCredits"
text?: string
askResponse?: ClaudeAskResponse
apiConfiguration?: ApiConfiguration

View File

@@ -1,4 +1,4 @@
export type ApiProvider = "anthropic" | "openrouter" | "bedrock" | "maestro"
export type ApiProvider = "anthropic" | "openrouter" | "bedrock" | "kodu"
export interface ApiHandlerOptions {
apiModelId?: ApiModelId
@@ -7,7 +7,8 @@ export interface ApiHandlerOptions {
awsAccessKey?: string
awsSecretKey?: string
awsRegion?: string
maestroToken?: string
koduApiKey?: string
koduEmail?: string
}
export type ApiConfiguration = ApiHandlerOptions & {
@@ -234,9 +235,9 @@ export const openRouterModels = {
// },
} as const satisfies Record<string, ModelInfo>
// Maestro
export type MaestroModelId = keyof typeof maestroModels
export const maestroDefaultModelId: MaestroModelId = "claude-3-5-sonnet-20240620"
export const maestroModels = {
// Kodu
export type KoduModelId = keyof typeof koduModels
export const koduDefaultModelId: KoduModelId = "claude-3-5-sonnet-20240620"
export const koduModels = {
...anthropicModels,
} as const satisfies Record<string, ModelInfo>

View File

@@ -1,10 +0,0 @@
import { z } from "zod"
export const MaestroUserSchema = z.object({
id: z.string(),
image: z.string().nullable(),
email: z.string().email(),
name: z.string().nullable(),
emailVerified: z.coerce.date().nullable(),
})
export type MaestroUser = z.infer<typeof MaestroUserSchema>