Skip to content

Commit

Permalink
move ModelsService to modelsService.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
sqs committed Sep 20, 2024
1 parent 9f226eb commit 26d0006
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 23 deletions.
5 changes: 4 additions & 1 deletion lib/shared/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ export {
modelsService,
mockModelsService,
ModelsService,
ModelCategory,
ModelTier,
type ServerModelConfiguration,
} from './models'
} from './models/modelsService'
export {
type Model,
type ServerModel,
Expand All @@ -30,6 +32,7 @@ export {
isCodyProModel,
isCustomModel,
toModelRefStr,
isWaitlistModel,
} from './models/utils'
export { BotResponseMultiplexer } from './chat/bot-response-multiplexer'
export { ChatClient } from './chat/chat'
Expand Down
2 changes: 1 addition & 1 deletion lib/shared/src/llm-providers/clients.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ChatNetworkClient, ChatNetworkClientParams } from '.'
import { googleChatClient, groqChatClient, ollamaChatClient } from '..'
import { modelsService } from '../models'
import { modelsService } from '../models/modelsService'
import { isCustomModel } from '../models/utils'
import { anthropicChatClient } from './anthropic/chat-client'

Expand Down
2 changes: 1 addition & 1 deletion lib/shared/src/llm-providers/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { CompletionsModelConfig } from '.'
import { modelsService } from '../models'
import { modelsService } from '../models/modelsService'

export function getCompletionsModelConfig(modelID: string): CompletionsModelConfig | undefined {
const provider = modelsService.getModelByID(modelID)
Expand Down
4 changes: 2 additions & 2 deletions lib/shared/src/models/model.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { CHAT_INPUT_TOKEN_BUDGET, CHAT_OUTPUT_TOKEN_BUDGET } from '../token/constants'
import {
type ClientSideConfig,
type ContextWindow,
Expand All @@ -8,8 +9,7 @@ import {
type ModelStatus,
type ModelTier,
capabilityToUsage,
} from '.'
import { CHAT_INPUT_TOKEN_BUDGET, CHAT_OUTPUT_TOKEN_BUDGET } from '../token/constants'
} from './modelsService'
import { ModelTag } from './tags'
import type { ModelContextWindow, ModelUsage } from './types'
import { getModelInfo } from './utils'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { mockAuthStatus } from '../auth/authStatus'
import { AUTH_STATUS_FIXTURE_AUTHED, type AuthenticatedAuthStatus } from '../auth/types'
import { DOTCOM_URL } from '../sourcegraph-api/environments'
import { CHAT_INPUT_TOKEN_BUDGET, CHAT_OUTPUT_TOKEN_BUDGET } from '../token/constants'
import { getDotComDefaultModels } from './dotcom'
import type { ServerModel } from './model'
import { createModel, createModelFromServerModel, modelTier } from './model'
import {
type ModelCategory,
type ModelTier,
ModelsService,
type ServerModelConfiguration,
type TestStorage,
mockModelsService,
} from '../models/index'
import { DOTCOM_URL } from '../sourcegraph-api/environments'
import { CHAT_INPUT_TOKEN_BUDGET, CHAT_OUTPUT_TOKEN_BUDGET } from '../token/constants'
import { getDotComDefaultModels } from './dotcom'
import type { ServerModel } from './model'
import { createModel, createModelFromServerModel, modelTier } from './model'
} from './modelsService'
import { ModelTag } from './tags'
import { ModelUsage } from './types'

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/shared/src/models/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ModelRef, ModelRefStr } from '.'
import { ModelTag } from '..'
import type { Model } from './model'
import type { ModelRef, ModelRefStr } from './modelsService'

export function getProviderName(name: string): string {
const providerName = name.toLowerCase()
Expand Down
2 changes: 1 addition & 1 deletion lib/shared/src/sourcegraph-api/rest/client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ServerModelConfiguration } from '../../models/index'
import type { ServerModelConfiguration } from '../../models/modelsService'

import { fetch } from '../../fetch'
import { logError } from '../../logger'
Expand Down
6 changes: 1 addition & 5 deletions vscode/test/e2e/enterprise-server-sent-models.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { expect } from '@playwright/test'
import type {
ModelCategory,
ModelTier,
ServerModelConfiguration,
} from '@sourcegraph/cody-shared/src/models'
import type { ModelCategory, ModelTier, ServerModelConfiguration } from '@sourcegraph/cody-shared'
import { createEmptyChatPanel, sidebarSignin } from './common'
import { test } from './helpers'

Expand Down
2 changes: 1 addition & 1 deletion vscode/test/fixtures/mock-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { PubSub } from "@google-cloud/pubsub";
import express from "express";
import * as uuid from "uuid";

import type { ServerModelConfiguration } from "@sourcegraph/cody-shared/src/models";
import type { ServerModelConfiguration } from "@sourcegraph/cody-shared";
import type { TelemetryEventInput } from "@sourcegraph/telemetry";

// create interface for the request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react'

import { VSCodeStandaloneComponent } from '../../storybook/VSCodeStoryDecorator'

import { type Model, ModelUsage, getDotComDefaultModels } from '@sourcegraph/cody-shared'
import { ModelTag } from '@sourcegraph/cody-shared/src/models/tags'
import { type Model, ModelTag, ModelUsage, getDotComDefaultModels } from '@sourcegraph/cody-shared'
import { useArgs } from '@storybook/preview-api'
import { ModelSelectField } from './ModelSelectField'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { type Model, ModelTag, isCodyProModel } from '@sourcegraph/cody-shared'
import { isWaitlistModel } from '@sourcegraph/cody-shared/src/models/utils'
import { type Model, ModelTag, isCodyProModel, isWaitlistModel } from '@sourcegraph/cody-shared'
import { clsx } from 'clsx'
import { BookOpenIcon, BuildingIcon, ExternalLinkIcon } from 'lucide-react'
import { type FunctionComponent, type ReactNode, useCallback, useMemo } from 'react'
Expand Down

0 comments on commit 26d0006

Please sign in to comment.