More type fixes
Browse files- app/components/chat/BaseChat.tsx +2 -1
- app/components/chat/Chat.client.tsx +2 -1
- app/lib/.server/llm/model.ts +0 -1
- app/types/model.ts +10 -0
- app/utils/constants.ts +1 -11
- app/utils/types.ts +9 -0
app/components/chat/BaseChat.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import { Menu } from '~/components/sidebar/Menu.client';
|
|
| 7 |
import { IconButton } from '~/components/ui/IconButton';
|
| 8 |
import { Workbench } from '~/components/workbench/Workbench.client';
|
| 9 |
import { classNames } from '~/utils/classNames';
|
| 10 |
-
import { MODEL_LIST, DEFAULT_PROVIDER, PROVIDER_LIST,
|
| 11 |
import { Messages } from './Messages.client';
|
| 12 |
import { SendButton } from './SendButton.client';
|
| 13 |
import { useState } from 'react';
|
|
@@ -15,6 +15,7 @@ import { APIKeyManager } from './APIKeyManager';
|
|
| 15 |
import Cookies from 'js-cookie';
|
| 16 |
|
| 17 |
import styles from './BaseChat.module.scss';
|
|
|
|
| 18 |
|
| 19 |
const EXAMPLE_PROMPTS = [
|
| 20 |
{ text: 'Build a todo app in React using Tailwind' },
|
|
|
|
| 7 |
import { IconButton } from '~/components/ui/IconButton';
|
| 8 |
import { Workbench } from '~/components/workbench/Workbench.client';
|
| 9 |
import { classNames } from '~/utils/classNames';
|
| 10 |
+
import { MODEL_LIST, DEFAULT_PROVIDER, PROVIDER_LIST, initializeModelList } from '~/utils/constants';
|
| 11 |
import { Messages } from './Messages.client';
|
| 12 |
import { SendButton } from './SendButton.client';
|
| 13 |
import { useState } from 'react';
|
|
|
|
| 15 |
import Cookies from 'js-cookie';
|
| 16 |
|
| 17 |
import styles from './BaseChat.module.scss';
|
| 18 |
+
import type { ProviderInfo } from '~/utils/types';
|
| 19 |
|
| 20 |
const EXAMPLE_PROMPTS = [
|
| 21 |
{ text: 'Build a todo app in React using Tailwind' },
|
app/components/chat/Chat.client.tsx
CHANGED
|
@@ -11,11 +11,12 @@ import { useChatHistory } from '~/lib/persistence';
|
|
| 11 |
import { chatStore } from '~/lib/stores/chat';
|
| 12 |
import { workbenchStore } from '~/lib/stores/workbench';
|
| 13 |
import { fileModificationsToHTML } from '~/utils/diff';
|
| 14 |
-
import { DEFAULT_MODEL, DEFAULT_PROVIDER, PROVIDER_LIST
|
| 15 |
import { cubicEasingFn } from '~/utils/easings';
|
| 16 |
import { createScopedLogger, renderLogger } from '~/utils/logger';
|
| 17 |
import { BaseChat } from './BaseChat';
|
| 18 |
import Cookies from 'js-cookie';
|
|
|
|
| 19 |
|
| 20 |
const toastAnimation = cssTransition({
|
| 21 |
enter: 'animated fadeInRight',
|
|
|
|
| 11 |
import { chatStore } from '~/lib/stores/chat';
|
| 12 |
import { workbenchStore } from '~/lib/stores/workbench';
|
| 13 |
import { fileModificationsToHTML } from '~/utils/diff';
|
| 14 |
+
import { DEFAULT_MODEL, DEFAULT_PROVIDER, PROVIDER_LIST } from '~/utils/constants';
|
| 15 |
import { cubicEasingFn } from '~/utils/easings';
|
| 16 |
import { createScopedLogger, renderLogger } from '~/utils/logger';
|
| 17 |
import { BaseChat } from './BaseChat';
|
| 18 |
import Cookies from 'js-cookie';
|
| 19 |
+
import type { ProviderInfo } from '~/utils/types';
|
| 20 |
|
| 21 |
const toastAnimation = cssTransition({
|
| 22 |
enter: 'animated fadeInRight',
|
app/lib/.server/llm/model.ts
CHANGED
|
@@ -6,7 +6,6 @@ import { createOpenAI } from '@ai-sdk/openai';
|
|
| 6 |
import { createGoogleGenerativeAI } from '@ai-sdk/google';
|
| 7 |
import { ollama } from 'ollama-ai-provider';
|
| 8 |
import { createOpenRouter } from "@openrouter/ai-sdk-provider";
|
| 9 |
-
import { mistral } from '@ai-sdk/mistral';
|
| 10 |
import { createMistral } from '@ai-sdk/mistral';
|
| 11 |
|
| 12 |
export function getAnthropicModel(apiKey: string, model: string) {
|
|
|
|
| 6 |
import { createGoogleGenerativeAI } from '@ai-sdk/google';
|
| 7 |
import { ollama } from 'ollama-ai-provider';
|
| 8 |
import { createOpenRouter } from "@openrouter/ai-sdk-provider";
|
|
|
|
| 9 |
import { createMistral } from '@ai-sdk/mistral';
|
| 10 |
|
| 11 |
export function getAnthropicModel(apiKey: string, model: string) {
|
app/types/model.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { ModelInfo } from '~/utils/types';
|
| 2 |
+
|
| 3 |
+
export type ProviderInfo = {
|
| 4 |
+
staticModels: ModelInfo[],
|
| 5 |
+
name: string,
|
| 6 |
+
getDynamicModels?: () => Promise<ModelInfo[]>,
|
| 7 |
+
getApiKeyLink?: string,
|
| 8 |
+
labelForGetApiKey?: string,
|
| 9 |
+
icon?:string,
|
| 10 |
+
};
|
app/utils/constants.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import type { ModelInfo, OllamaApiResponse, OllamaModel } from './types';
|
| 2 |
|
| 3 |
export const WORK_DIR_NAME = 'project';
|
| 4 |
export const WORK_DIR = `/home/${WORK_DIR_NAME}`;
|
|
@@ -7,16 +7,6 @@ export const MODEL_REGEX = /^\[Model: (.*?)\]\n\n/;
|
|
| 7 |
export const PROVIDER_REGEX = /\[Provider: (.*?)\]\n\n/;
|
| 8 |
export const DEFAULT_MODEL = 'claude-3-5-sonnet-latest';
|
| 9 |
|
| 10 |
-
|
| 11 |
-
export type ProviderInfo = {
|
| 12 |
-
staticModels: ModelInfo[],
|
| 13 |
-
name: string,
|
| 14 |
-
getDynamicModels?: () => Promise<ModelInfo[]>,
|
| 15 |
-
getApiKeyLink?: string,
|
| 16 |
-
labelForGetApiKey?: string,
|
| 17 |
-
icon?:string,
|
| 18 |
-
};
|
| 19 |
-
|
| 20 |
const PROVIDER_LIST: ProviderInfo[] = [
|
| 21 |
{
|
| 22 |
name: 'Anthropic',
|
|
|
|
| 1 |
+
import type { ModelInfo, OllamaApiResponse, OllamaModel, ProviderInfo } from './types';
|
| 2 |
|
| 3 |
export const WORK_DIR_NAME = 'project';
|
| 4 |
export const WORK_DIR = `/home/${WORK_DIR_NAME}`;
|
|
|
|
| 7 |
export const PROVIDER_REGEX = /\[Provider: (.*?)\]\n\n/;
|
| 8 |
export const DEFAULT_MODEL = 'claude-3-5-sonnet-latest';
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
const PROVIDER_LIST: ProviderInfo[] = [
|
| 11 |
{
|
| 12 |
name: 'Anthropic',
|
app/utils/types.ts
CHANGED
|
@@ -26,3 +26,12 @@ export interface ModelInfo {
|
|
| 26 |
label: string;
|
| 27 |
provider: string;
|
| 28 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
label: string;
|
| 27 |
provider: string;
|
| 28 |
}
|
| 29 |
+
|
| 30 |
+
export interface ProviderInfo {
|
| 31 |
+
staticModels: ModelInfo[],
|
| 32 |
+
name: string,
|
| 33 |
+
getDynamicModels?: () => Promise<ModelInfo[]>,
|
| 34 |
+
getApiKeyLink?: string,
|
| 35 |
+
labelForGetApiKey?: string,
|
| 36 |
+
icon?:string,
|
| 37 |
+
};
|