From e95fb624102ed062fbf3da92a4577e50216ae777 Mon Sep 17 00:00:00 2001 From: Mattias Granlund Date: Thu, 4 Apr 2024 19:00:21 +0200 Subject: [PATCH] Flatten the AI service directory - resolves cyclic dependency between the two packages --- app/src/lib/backend/aiService.test.ts | 8 ++++---- app/src/lib/backend/aiService.ts | 8 ++++---- app/src/lib/backend/{aiClients => }/anthropic.ts | 0 app/src/lib/backend/{aiClients => }/butler.ts | 0 app/src/lib/backend/cloud.ts | 2 +- app/src/lib/backend/{aiClients => }/openAI.ts | 0 app/src/lib/backend/{aiClients => }/types.ts | 0 app/src/lib/components/AISettings.svelte | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) rename app/src/lib/backend/{aiClients => }/anthropic.ts (100%) rename app/src/lib/backend/{aiClients => }/butler.ts (100%) rename app/src/lib/backend/{aiClients => }/openAI.ts (100%) rename app/src/lib/backend/{aiClients => }/types.ts (100%) diff --git a/app/src/lib/backend/aiService.test.ts b/app/src/lib/backend/aiService.test.ts index f4aba8df9..cf21cb576 100644 --- a/app/src/lib/backend/aiService.test.ts +++ b/app/src/lib/backend/aiService.test.ts @@ -1,9 +1,9 @@ -import { AnthropicModelName, ModelKind, OpenAIModelName } from './aiClients/types'; import { CloudClient } from './cloud'; -import { AnthropicAIClient } from '$lib/backend/aiClients/anthropic'; -import { ButlerAIClient } from '$lib/backend/aiClients/butler'; -import { OpenAIClient } from '$lib/backend/aiClients/openAI'; +import { AnthropicModelName, ModelKind, OpenAIModelName } from './types'; import { AIService, GitAIConfigKey, KeyOption, buildDiff } from '$lib/backend/aiService'; +import { AnthropicAIClient } from '$lib/backend/anthropic'; +import { ButlerAIClient } from '$lib/backend/butler'; +import { OpenAIClient } from '$lib/backend/openAI'; import * as toasts from '$lib/utils/toasts'; import { Hunk } from '$lib/vbranches/types'; import { plainToInstance } from 'class-transformer'; diff --git a/app/src/lib/backend/aiService.ts b/app/src/lib/backend/aiService.ts index cc5aa2845..a5c42eb5f 100644 --- a/app/src/lib/backend/aiService.ts +++ b/app/src/lib/backend/aiService.ts @@ -1,7 +1,7 @@ -import { AnthropicModelName, OpenAIModelName } from './aiClients/types'; -import { AnthropicAIClient } from '$lib/backend/aiClients/anthropic'; -import { ButlerAIClient } from '$lib/backend/aiClients/butler'; -import { OpenAIClient } from '$lib/backend/aiClients/openAI'; +import { AnthropicModelName, OpenAIModelName } from './types'; +import { AnthropicAIClient } from '$lib/backend/anthropic'; +import { ButlerAIClient } from '$lib/backend/butler'; +import { OpenAIClient } from '$lib/backend/openAI'; import { splitMessage } from '$lib/utils/commitMessage'; import * as toasts from '$lib/utils/toasts'; import OpenAI from 'openai'; diff --git a/app/src/lib/backend/aiClients/anthropic.ts b/app/src/lib/backend/anthropic.ts similarity index 100% rename from app/src/lib/backend/aiClients/anthropic.ts rename to app/src/lib/backend/anthropic.ts diff --git a/app/src/lib/backend/aiClients/butler.ts b/app/src/lib/backend/butler.ts similarity index 100% rename from app/src/lib/backend/aiClients/butler.ts rename to app/src/lib/backend/butler.ts diff --git a/app/src/lib/backend/cloud.ts b/app/src/lib/backend/cloud.ts index 4537a9be1..b0d3c9036 100644 --- a/app/src/lib/backend/cloud.ts +++ b/app/src/lib/backend/cloud.ts @@ -1,6 +1,6 @@ import { invoke } from './ipc'; import type { PromptMessage } from '$lib/backend/aiClient'; -import type { ModelKind } from './aiClients/types'; +import type { ModelKind } from './types'; import { PUBLIC_API_BASE_URL } from '$env/static/public'; const apiUrl = new URL('/api/', new URL(PUBLIC_API_BASE_URL)); diff --git a/app/src/lib/backend/aiClients/openAI.ts b/app/src/lib/backend/openAI.ts similarity index 100% rename from app/src/lib/backend/aiClients/openAI.ts rename to app/src/lib/backend/openAI.ts diff --git a/app/src/lib/backend/aiClients/types.ts b/app/src/lib/backend/types.ts similarity index 100% rename from app/src/lib/backend/aiClients/types.ts rename to app/src/lib/backend/types.ts diff --git a/app/src/lib/components/AISettings.svelte b/app/src/lib/components/AISettings.svelte index 1f825e4d6..58e0b5510 100644 --- a/app/src/lib/components/AISettings.svelte +++ b/app/src/lib/components/AISettings.svelte @@ -5,9 +5,9 @@ import Spacer from './Spacer.svelte'; import TextBox from './TextBox.svelte'; import WelcomeSigninAction from './WelcomeSigninAction.svelte'; - import { OpenAIModelName, AnthropicModelName, ModelKind } from '$lib/backend/aiClients/types'; import { AIService, GitAIConfigKey, KeyOption } from '$lib/backend/aiService'; import { GitConfigService } from '$lib/backend/gitConfigService'; + import { OpenAIModelName, AnthropicModelName, ModelKind } from '$lib/backend/types'; import RadioButton from '$lib/components/RadioButton.svelte'; import SectionCard from '$lib/components/SectionCard.svelte'; import { UserService } from '$lib/stores/user';