diff --git a/bun.lockb b/bun.lockb index 3524799..2f80e4a 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 93fddd6..fc08dac 100644 --- a/package.json +++ b/package.json @@ -1,92 +1,92 @@ { - "name": "max-chatbot", - "version": "0.8.2", - "description": "Generate and brainstorm ideas while creating your notes using Large Language Models (LLMs) from Ollama, LM Studio, Anthropic, OpenAI, Mistral AI, and more for Obsidian.", - "main": "main.js", - "scripts": { - "dev": "VITE_CJS_IGNORE_WARNING=true vite build --mode development --watch", - "build": "VITE_CJS_IGNORE_WARNING=true vite build --mode production", - "version": "node version-bump.mjs && git add manifest.json versions.json", - "format": "prettier --write \"src/**/*.{ts,tsx}\"", - "prepare": "husky", - "lint": "eslint ./src", - "lint:fix": "eslint ./src --fix", - "lint:quiet": "eslint ./src --quiet", - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [ - "obsidian", - "chatbot", - "chatgpt", - "ollama" - ], - "author": "anpigon", - "license": "MIT", - "devDependencies": { - "@commitlint/config-conventional": "^19.2.2", - "@eslint/js": "^9.5.0", - "@rollup/plugin-json": "^6.1.0", - "@rollup/plugin-typescript": "^11.1.6", - "@trivago/prettier-plugin-sort-imports": "^4.3.0", - "@types/lodash": "^4.17.5", - "@types/node": "^20.14.7", - "@types/react": "^18.3.2", - "@types/react-dom": "^18.3.0", - "@typescript-eslint/eslint-plugin": "^7.13.1", - "@typescript-eslint/parser": "^7.10.0", - "@vitejs/plugin-react": "^4.3.1", - "@vitejs/plugin-react-swc": "^3.7.0", - "autoprefixer": "^10.4.19", - "builtin-modules": "^3.3.0", - "bun-types": "latest", - "esbuild": "0.21.5", - "eslint": "^9.5.0", - "husky": "^9.0.11", - "obsidian": "latest", - "postcss": "^8.4.38", - "postcss-prefix-selector": "^1.16.1", - "prettier": "^3.3.2", - "prettier-plugin-sort-imports": "^1.8.5", - "prettier-plugin-tailwindcss": "^0.6.5", - "rollup-plugin-copy": "^3.5.0", - "tailwindcss": "^3.4.4", - "tslib": "^2.6.3", - "typescript": "^5.4.5", - "typescript-eslint": "^7.13.1", - "vite": "^5.3.1" - }, - "dependencies": { - "@commitlint/cli": "^19.3.0", - "@heroicons/react": "^2.1.4", - "@langchain/community": "^0.2.12", - "@langchain/google-genai": "^0.0.20", - "@langchain/groq": "^0.0.12", - "@langchain/openai": "^0.1.3", - "@msgpack/msgpack": "^3.0.0-beta2", - "@orama/orama": "^2.0.20", - "@popperjs/core": "^2.11.8", - "clsx": "^2.1.1", - "i18next": "^23.11.5", - "langchain": "^0.2.5", - "lodash": "^4.17.21", - "merge-refs": "^1.3.0", - "monkey-around": "^2.3.0", - "openai": "^4.52.0", - "react": "^18.3.1", - "react-dom": "^18.3.1", - "react-i18next": "^14.1.2", - "tailwind-merge": "^2.3.0", - "usehooks-ts": "^3.1.0" - }, - "overrides": { - "@langchain/core": "0.2.0" - }, - "resolutions": { - "@langchain/core": "0.2.0" - }, - "pnpm": { - "overrides": { - "@langchain/core": "0.2.0" - } - } + "name": "max-chatbot", + "version": "0.8.2", + "description": "Generate and brainstorm ideas while creating your notes using Large Language Models (LLMs) from Ollama, LM Studio, Anthropic, OpenAI, Mistral AI, and more for Obsidian.", + "main": "main.js", + "scripts": { + "dev": "VITE_CJS_IGNORE_WARNING=true vite build --mode development --watch", + "build": "VITE_CJS_IGNORE_WARNING=true vite build --mode production", + "version": "node version-bump.mjs && git add manifest.json versions.json", + "format": "prettier --write \"src/**/*.{ts,tsx}\"", + "prepare": "husky", + "lint": "eslint ./src", + "lint:fix": "eslint ./src --fix", + "lint:quiet": "eslint ./src --quiet", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [ + "obsidian", + "chatbot", + "chatgpt", + "ollama" + ], + "author": "anpigon", + "license": "MIT", + "devDependencies": { + "@commitlint/config-conventional": "^19.2.2", + "@eslint/js": "^9.6.0", + "@rollup/plugin-json": "^6.1.0", + "@rollup/plugin-typescript": "^11.1.6", + "@trivago/prettier-plugin-sort-imports": "^4.3.0", + "@types/lodash": "^4.17.6", + "@types/node": "^20.14.10", + "@types/react": "^18.3.3", + "@types/react-dom": "^18.3.0", + "@typescript-eslint/eslint-plugin": "^7.15.0", + "@typescript-eslint/parser": "^7.15.0", + "@vitejs/plugin-react": "^4.3.1", + "@vitejs/plugin-react-swc": "^3.7.0", + "autoprefixer": "^10.4.19", + "builtin-modules": "^3.3.0", + "bun-types": "latest", + "esbuild": "0.23.0", + "eslint": "^9.6.0", + "husky": "^9.0.11", + "obsidian": "latest", + "postcss": "^8.4.39", + "postcss-prefix-selector": "^1.16.1", + "prettier": "^3.3.2", + "prettier-plugin-sort-imports": "^1.8.5", + "prettier-plugin-tailwindcss": "^0.6.5", + "rollup-plugin-copy": "^3.5.0", + "tailwindcss": "^3.4.4", + "tslib": "^2.6.3", + "typescript": "^5.4.5", + "typescript-eslint": "^7.15.0", + "vite": "^5.3.3" + }, + "dependencies": { + "@commitlint/cli": "^19.3.0", + "@heroicons/react": "^2.1.4", + "@langchain/anthropic": "^0.2.3", + "@langchain/community": "^0.2.17", + "@langchain/google-genai": "^0.0.21", + "@langchain/groq": "^0.0.13", + "@langchain/openai": "^0.2.1", + "@msgpack/msgpack": "3.0.0-beta2", + "@orama/orama": "^2.0.21", + "@popperjs/core": "^2.11.8", + "clsx": "^2.1.1", + "i18next": "^23.11.5", + "langchain": "^0.2.8", + "lodash": "^4.17.21", + "merge-refs": "^1.3.0", + "monkey-around": "^2.3.0", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "react-i18next": "^14.1.2", + "tailwind-merge": "^2.3.0", + "usehooks-ts": "^3.1.0" + }, + "overrides": { + "@langchain/core": "0.2.14" + }, + "resolutions": { + "@langchain/core": "0.2.14" + }, + "pnpm": { + "overrides": { + "@langchain/core": "0.2.14" + } + } } diff --git a/src/constants.ts b/src/constants.ts index 001a889..19b88b2 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -14,7 +14,7 @@ export const UPSTAGE_MODELS = [ 'solar-1-mini-chat', // GPT-3.5보다 뛰어난 성능을 제공하는 소형 LLM으로, 영어와 한국어를 모두 지원하는 강력한 다국어 기능을 갖추고 있어 더 작은 패키지로 높은 효율성을 제공합니다. Context Length: 32768 'solar-1-mini-chat-ja', // 영어와 한국어의 높은 효율성과 성능을 유지하면서 일본어에 특화된 solar-mini-chat의 기능을 확장한 소형 LLM입니다. Context Length: 32768 ]; -export const ANTHROPIC_MODELS = ['claude-instant-1.2', 'claude-2.0', 'claude-2.1', 'claude-3-opus-20240229', 'claude-3-sonnet-20240229']; +export const ANTHROPIC_MODELS = ['claude-3-5-sonnet-20240620', 'claude-3-opus-20240229', 'claude-3-sonnet-20240229', 'claude-3-haiku-20240307']; export const OPEN_AI_MODELS = ['gpt-3.5-turbo', 'gpt-4o', 'gpt-4']; export const enum LLM_PROVIDERS { diff --git a/src/features/chatbot/components/chatbot-header.tsx b/src/features/chatbot/components/chatbot-header.tsx index 88b96fb..8a39679 100644 --- a/src/features/chatbot/components/chatbot-header.tsx +++ b/src/features/chatbot/components/chatbot-header.tsx @@ -1,8 +1,8 @@ import {ReactNode, type ChangeEventHandler, type FC, type PropsWithChildren} from 'react'; +import {ANTHROPIC_MODELS, LLM_PROVIDERS} from '@/constants'; import {ProviderModels} from '@/hooks/useEnabledModels'; import {Dropdown} from '@/components/form/dropdown'; -import {LLM_PROVIDERS} from '@/constants'; interface ChatbotHeaderProps extends PropsWithChildren { botName: string; @@ -18,6 +18,14 @@ interface ChatbotHeaderProps extends PropsWithChildren { rightComponent?: ReactNode; } +function getModels(provider: LLM_PROVIDERS, models: string[]) { + let currentModels = models.filter(model => model !== 'embed'); + if (provider === LLM_PROVIDERS.ANTHROPIC && !currentModels?.length) { + currentModels = ANTHROPIC_MODELS; + } + return currentModels; +} + export const ChatbotHeader: FC = ({botName, providers, disabled, currentModel, onChangeModel, leftComponent, rightComponent, children}) => { const handleChangeModel: ChangeEventHandler = e => { const value = e.target.value; @@ -37,11 +45,12 @@ export const ChatbotHeader: FC = ({botName, providers, disab disabled={disabled} > {providers - ?.filter(({provider, models}) => models.length > 0) + ?.filter(({models}) => models.length > 0) .map(({provider, models}) => { + const currentModels = getModels(provider, models); return ( - {models.map(model => { + {currentModels.map(model => { const value = `${provider}/${model}`; return (