diff --git a/core/src/types/index.ts b/core/src/types/index.ts index 7580c2432..7a7faad6d 100644 --- a/core/src/types/index.ts +++ b/core/src/types/index.ts @@ -183,6 +183,11 @@ export interface Model { */ version: number; + /** + * The format of the model. + */ + format: string; + /** * The model download source. It can be an external url or a local filepath. */ diff --git a/electron/handlers/update.ts b/electron/handlers/update.ts index 08d32fffe..667acca95 100644 --- a/electron/handlers/update.ts +++ b/electron/handlers/update.ts @@ -33,7 +33,6 @@ export function handleAppUpdates() { /* App Update Error */ autoUpdater.on("error", (info: any) => { - dialog.showMessageBox({ message: info.message }); WindowManager.instance.currentWindow?.webContents.send( "APP_UPDATE_ERROR", {} diff --git a/extensions/assistant-extension/src/index.ts b/extensions/assistant-extension/src/index.ts index 8d01021b7..3e1ab4898 100644 --- a/extensions/assistant-extension/src/index.ts +++ b/extensions/assistant-extension/src/index.ts @@ -96,7 +96,7 @@ export default class JanAssistantExtension implements AssistantExtension { name: "Jan", description: "A default assistant that can use all downloaded models", model: "*", - instructions: "Your name is Jan.", + instructions: "", tools: undefined, file_ids: [], metadata: undefined, diff --git a/extensions/inference-extension/nitro/version.txt b/extensions/inference-extension/nitro/version.txt index 964f548b5..790629964 100644 --- a/extensions/inference-extension/nitro/version.txt +++ b/extensions/inference-extension/nitro/version.txt @@ -1 +1 @@ -0.1.20 \ No newline at end of file +0.1.21 diff --git a/models/capybara-34b/model.json b/models/capybara-34b/model.json index 562bcbe93..788214a3a 100644 --- a/models/capybara-34b/model.json +++ b/models/capybara-34b/model.json @@ -2,22 +2,22 @@ "source_url": "https://huggingface.co/TheBloke/Nous-Capybara-34B-GGUF/resolve/main/nous-capybara-34b.Q5_K_M.gguf", "id": "capybara-34b", "object": "model", - "name": "Capybara 200k 34B", - "version": 1.0, + "name": "Capybara 200k 34B Q5", + "version": "1.0", "description": "Nous Capybara 34B, a variant of the Yi-34B model, is the first Nous model with a 200K context length, trained for three epochs on the innovative Capybara dataset.", "format": "gguf", "settings": { - "ctx_len": 4096, + "ctx_len": 2048, "system_prompt": "", - "user_prompt": "USER: ", - "ai_prompt": "ASSISTANT: " + "user_prompt": "USER:\n", + "ai_prompt": "ASSISTANT:\n" }, "parameters": { - "max_tokens": 4096 + "max_tokens": 2048 }, "metadata": { "author": "NousResearch, The Bloke", - "tags": ["General", "Big Context Length"], + "tags": ["Medium", "Finetuned"], "size": 24320000000 } } diff --git a/models/deepseek-coder-1.3b/model.json b/models/deepseek-coder-1.3b/model.json index 2ff6d6e7b..4bab24ae2 100644 --- a/models/deepseek-coder-1.3b/model.json +++ b/models/deepseek-coder-1.3b/model.json @@ -1,23 +1,23 @@ { - "source_url": "https://huggingface.co/TheBloke/deepseek-coder-1.3b-base-GGUF/resolve/main/deepseek-coder-1.3b-base.Q4_K_M.gguf", + "source_url": "https://huggingface.co/TheBloke/deepseek-coder-1.3b-instruct-GGUF/resolve/main/deepseek-coder-1.3b-instruct.Q8_0.gguf", "id": "deepseek-coder-1.3b", "object": "model", - "name": "Deepseek Coder 1.3B", + "name": "Deepseek Coder 1.3B Q8", "version": "1.0", - "description": "", + "description": "Deepseek Coder trained on 2T tokens (87% code, 13% English/Chinese), excelling in project-level code completion with advanced capabilities across multiple programming languages.", "format": "gguf", "settings": { - "ctx_len": 4096, + "ctx_len": 2048, "system_prompt": "", - "user_prompt": "", - "ai_prompt": "" + "user_prompt": "### Instruction:\n", + "ai_prompt": "### Response:\n" }, "parameters": { - "max_tokens": 4096 + "max_tokens": 2048 }, "metadata": { - "author": "deepseek, The Bloke", - "tags": ["Code"], - "size": 870000000 + "author": "Deepseek, The Bloke", + "tags": ["Tiny", "Foundational Model"], + "size": 1430000000 } } diff --git a/models/deepseek-coder-34b/model.json b/models/deepseek-coder-34b/model.json new file mode 100644 index 000000000..c5a2b5625 --- /dev/null +++ b/models/deepseek-coder-34b/model.json @@ -0,0 +1,24 @@ +{ + "source_url": "https://huggingface.co/TheBloke/deepseek-coder-33B-instruct-GGUF/resolve/main/deepseek-coder-33b-instruct.Q5_K_M.gguf", + "id": "deepseek-coder-34b", + "object": "model", + "name": "Deepseek Coder 33B Q5", + "version": "1.0", + "description": "Deepseek Coder trained on 2T tokens (87% code, 13% English/Chinese), excelling in project-level code completion with advanced capabilities across multiple programming languages.", + "format": "gguf", + "settings": { + "ctx_len": 2048, + "system_prompt": "", + "user_prompt": "### Instruction:\n", + "ai_prompt": "### Response:\n" + }, + "parameters": { + "max_tokens": 2048 + }, + "metadata": { + "author": "Deepseek, The Bloke", + "tags": ["Medium", "Foundational Model"], + "size": 26040000000 + } + } + \ No newline at end of file diff --git a/models/dolphin-yi-34b/model.json b/models/dolphin-yi-34b/model.json deleted file mode 100644 index 3b1bf3619..000000000 --- a/models/dolphin-yi-34b/model.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "source_url": "https://huggingface.co/TheBloke/dolphin-2_2-yi-34b-GGUF/resolve/main/dolphin-2_2-yi-34b.Q5_K_M.gguf", - "id": "dolphin-yi-34b", - "object": "model", - "name": "Dolphin Yi 34B", - "version": "1.0", - "description": "Dolphin, based on the Yi-34B model and enhanced with features like conversation and empathy, is trained on a unique dataset for advanced multi-turn conversations. Notably uncensored, it requires careful implementation of an alignment layer for ethical use.", - "format": "gguf", - "settings": { - "ctx_len": 4096, - "system_prompt": "<|im_start|>system\n", - "user_prompt": "<|im_end|>\n<|im_start|>user\n", - "ai_prompt": "<|im_end|>\n<|im_start|>assistant\n" - }, - "parameters": { - "max_tokens": 4096 - }, - "metadata": { - "author": "ehartford, The Bloke", - "tags": ["General Use", "Role-playing"], - "size": 24320000000 - } - } - \ No newline at end of file diff --git a/models/islm-3b/model.json b/models/islm-3b/model.json deleted file mode 100644 index 916d7c50e..000000000 --- a/models/islm-3b/model.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "source_url": "https://huggingface.co/UmbrellaCorp/IS-LM-3B_GGUF/resolve/main/IS-LM-Q4_K_M.gguf", - "id": "islm-3b", - "object": "model", - "name": "IS LM 3B", - "version": "1.0", - "description": "IS LM 3B, based on the StableLM 3B model is specifically finetuned for economic analysis using DataForge Economics and QLoRA over three epochs, enhancing its proficiency in economic forecasting and analysis.", - "format": "gguf", - "settings": { - "ctx_len": 4096, - "system_prompt": "", - "user_prompt": "USER: ", - "ai_prompt": "ASSISTANT: " - }, - "parameters": { - "max_tokens": 4096 - }, - "metadata": { - "author": "UmbrellaCorp, The Bloke", - "tags": ["General Use", "Economics"], - "size": 1710000000 - } - } - \ No newline at end of file diff --git a/models/llama2-chat-70b-q4/model.json b/models/llama2-chat-70b-q4/model.json new file mode 100644 index 000000000..6d089f9fa --- /dev/null +++ b/models/llama2-chat-70b-q4/model.json @@ -0,0 +1,24 @@ +{ + "source_url": "https://huggingface.co/TheBloke/Llama-2-70B-Chat-GGUF/resolve/main/llama-2-70b-chat.Q4_K_M.gguf", + "id": "llama2-chat-70b-q4", + "object": "model", + "name": "Llama 2 Chat 70B Q4", + "version": "1.0", + "description": "This is a 4-bit quantized version of Meta AI's Llama 2 Chat 70b model.", + "format": "gguf", + "settings": { + "ctx_len": 2048, + "system_prompt": "[INST] <>\n", + "user_prompt": "<>\n", + "ai_prompt": "[/INST]" + }, + "parameters": { + "max_tokens": 2048 + }, + "metadata": { + "author": "MetaAI, The Bloke", + "tags": ["Large", "Foundational Model"], + "size": 43920000000 + } + } + \ No newline at end of file diff --git a/models/llama2-chat-7b-q4/model.json b/models/llama2-chat-7b-q4/model.json new file mode 100644 index 000000000..3ba054018 --- /dev/null +++ b/models/llama2-chat-7b-q4/model.json @@ -0,0 +1,24 @@ +{ + "source_url": "https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGUF/resolve/main/llama-2-7b-chat.Q4_K_M.gguf", + "id": "llama2-chat-7b-q4", + "object": "model", + "name": "Llama 2 Chat 7B Q4", + "version": "1.0", + "description": "This is a 4-bit quantized iteration of Meta AI's Llama 2 Chat 7b model, specifically designed for a comprehensive understanding through training on extensive internet data.", + "format": "gguf", + "settings": { + "ctx_len": 2048, + "system_prompt": "[INST] <>\n", + "user_prompt": "<>\n", + "ai_prompt": "[/INST]" + }, + "parameters": { + "max_tokens": 2048 + }, + "metadata": { + "author": "MetaAI, The Bloke", + "tags": ["Small", "Foundational Model"], + "size": 4080000000 + } + } + \ No newline at end of file diff --git a/models/llama2-chat-7b-q5/model.json b/models/llama2-chat-7b-q5/model.json new file mode 100644 index 000000000..2889868d5 --- /dev/null +++ b/models/llama2-chat-7b-q5/model.json @@ -0,0 +1,24 @@ +{ + "source_url": "https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGUF/resolve/main/llama-2-7b-chat.Q5_K_M.gguf", + "id": "llama2-chat-7b-q5", + "object": "model", + "name": "Llama 2 Chat 7B Q5", + "version": "1.0", + "description": "This is a 5-bit quantized iteration of Meta AI's Llama 2 Chat 7b model, specifically designed for a comprehensive understanding through training on extensive internet data.", + "format": "gguf", + "settings": { + "ctx_len": 2048, + "system_prompt": "[INST] <>\n", + "user_prompt": "<>\n", + "ai_prompt": "[/INST]" + }, + "parameters": { + "max_tokens": 2048 + }, + "metadata": { + "author": "MetaAI, The Bloke", + "tags": ["Small", "Foundational Model"], + "size": 4780000000 + } + } + \ No newline at end of file diff --git a/models/lzlv-70b/model.json b/models/lzlv-70b/model.json index 4aaee79b3..85d857e6d 100644 --- a/models/lzlv-70b/model.json +++ b/models/lzlv-70b/model.json @@ -2,22 +2,22 @@ "source_url": "https://huggingface.co/TheBloke/lzlv_70B-GGUF/resolve/main/lzlv_70b_fp16_hf.Q5_K_M.gguf", "id": "lzlv-70b", "object": "model", - "name": "Lzlv 70B", + "name": "Lzlv 70B Q4", "version": "1.0", "description": "lzlv_70B is a sophisticated AI model designed for roleplaying and creative tasks. This merge aims to combine intelligence with creativity, seemingly outperforming its individual components in complex scenarios and creative outputs.", "format": "gguf", "settings": { - "ctx_len": 4096, + "ctx_len": 2048, "system_prompt": "", - "user_prompt": "USER: ", - "ai_prompt": "ASSISTANT: " + "user_prompt": "USER:\n", + "ai_prompt": "ASSISTANT:\n" }, "parameters": { - "max_tokens": 4096 + "max_tokens": 2048 }, "metadata": { - "author": "lizpreciatior, The Bloke", - "tags": ["General Use", "Role-playing"], + "author": "Lizpreciatior, The Bloke", + "tags": ["Large", "Finetuned"], "size": 48750000000 } } diff --git a/models/marx-3b/model.json b/models/marx-3b/model.json deleted file mode 100644 index 78617d5c3..000000000 --- a/models/marx-3b/model.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "source_url": "https://huggingface.co/TheBloke/Marx-3B-v3-GGUF/resolve/main/marx-3b-v3.Q4_K_M.gguf", - "id": "marx-3b", - "object": "model", - "name": "Marx 3B", - "version": "1.0", - "description": "Marx 3B, based on the StableLM 3B model is specifically finetuned for chating using EverythingLM data and QLoRA over two epochs, enhancing its proficiency in understand general knowledege.", - "format": "gguf", - "settings": { - "ctx_len": 4096, - "system_prompt": "", - "user_prompt": "### HUMAN: ", - "ai_prompt": "### RESPONSE: " - }, - "parameters": { - "max_tokens": 4096 - }, - "metadata": { - "author": "Bohan Du, The Bloke", - "tags": ["General Use"], - "size": 1620000000 - } - } \ No newline at end of file diff --git a/models/mistral-ins-7b-q4/model.json b/models/mistral-ins-7b-q4/model.json new file mode 100644 index 000000000..fe1bb0a5b --- /dev/null +++ b/models/mistral-ins-7b-q4/model.json @@ -0,0 +1,24 @@ +{ + "source_url": "https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.1-GGUF/resolve/main/mistral-7b-instruct-v0.1.Q4_K_M.gguf", + "id": "mistral-ins-7b-q4", + "object": "model", + "name": "Mistral Instruct 7B Q4", + "version": "1.0", + "description": "This is a 4-bit quantized iteration of MistralAI's Mistral Instruct 7b model, specifically designed for a comprehensive understanding through training on extensive internet data.", + "format": "gguf", + "settings": { + "ctx_len": 2048, + "system_prompt": "", + "user_prompt": "[INST]", + "ai_prompt": "[/INST]" + }, + "parameters": { + "max_tokens": 2048 + }, + "metadata": { + "author": "MistralAI, The Bloke", + "tags": ["Small", "Foundational Model"], + "size": 4370000000 + } + } + \ No newline at end of file diff --git a/models/mistral-ins-7b-q5/model.json b/models/mistral-ins-7b-q5/model.json new file mode 100644 index 000000000..13eb6bde9 --- /dev/null +++ b/models/mistral-ins-7b-q5/model.json @@ -0,0 +1,24 @@ +{ + "source_url": "https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.1-GGUF/resolve/main/mistral-7b-instruct-v0.1.Q5_K_M.gguf", + "id": "mistral-ins-7b-q5", + "object": "model", + "name": "Mistral Instruct 7B Q5", + "version": "1.0", + "description": "This is a 5-bit quantized iteration of MistralAI's Mistral Instruct 7b model, specifically designed for a comprehensive understanding through training on extensive internet data.", + "format": "gguf", + "settings": { + "ctx_len": 2048, + "system_prompt": "", + "user_prompt": "[INST]", + "ai_prompt": "[/INST]" + }, + "parameters": { + "max_tokens": 2048 + }, + "metadata": { + "author": "MistralAI, The Bloke", + "tags": ["Small", "Foundational Model"], + "size": 5130000000 + } + } + \ No newline at end of file diff --git a/models/mythomax-13b/model.json b/models/mythomax-13b/model.json deleted file mode 100644 index 455f73968..000000000 --- a/models/mythomax-13b/model.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "source_url": "https://huggingface.co/TheBloke/MythoMax-L2-13B-GGUF/resolve/main/mythomax-l2-13b.Q5_K_M.gguf", - "id": "mythomax-13b", - "object": "model", - "name": "Mythomax L2 13B", - "version": "1.0", - "description": "Mythomax L2 13b, an advanced AI model derived from MythoMix, merges MythoLogic-L2's deep comprehension with Huginn's writing skills through a unique tensor merge technique, excelling in roleplaying and storytelling.", - "format": "gguf", - "settings": { - "ctx_len": 4096, - "system_prompt": "", - "user_prompt": "### Instruction: ", - "ai_prompt": "### Response: " - }, - "parameters": { - "max_tokens": 4096 - }, - "metadata": { - "author": "Gryphe, The Bloke", - "tags": ["Role-playing"], - "size": 9230000000 - } - } - \ No newline at end of file diff --git a/models/neural-chat-7b/model.json b/models/neural-chat-7b/model.json index f4f4f14d4..cd0b3b3d0 100644 --- a/models/neural-chat-7b/model.json +++ b/models/neural-chat-7b/model.json @@ -2,22 +2,22 @@ "source_url": "https://huggingface.co/TheBloke/neural-chat-7B-v3-1-GGUF/resolve/main/neural-chat-7b-v3-1.Q4_K_M.gguf", "id": "neural-chat-7b", "object": "model", - "name": "Neural Chat 7B", + "name": "Neural Chat 7B Q4", "version": "1.0", "description": "The Neural Chat 7B model, developed on the foundation of mistralai/Mistral-7B-v0.1, has been fine-tuned using the Open-Orca/SlimOrca dataset and aligned with the Direct Preference Optimization (DPO) algorithm. It has demonstrated substantial improvements in various AI tasks and performance well on the open_llm_leaderboard.", "format": "gguf", "settings": { - "ctx_len": 4096, - "system_prompt": "### System: ", - "user_prompt": "### User: ", - "ai_prompt": "### Assistant: " + "ctx_len": 2048, + "system_prompt": "### System:\n", + "user_prompt": "### User:\n", + "ai_prompt": "### Assistant:\n" }, "parameters": { - "max_tokens": 4096 + "max_tokens": 2048 }, "metadata": { "author": "Intel, The Bloke", - "tags": ["General Use", "Role-playing", "Big Context Length"], + "tags": ["Recommended", "Small", "Finetuned"], "size": 4370000000 } } diff --git a/models/neuralhermes-7b/model.json b/models/neuralhermes-7b/model.json deleted file mode 100644 index 07cca58d4..000000000 --- a/models/neuralhermes-7b/model.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "source_url": "https://huggingface.co/TheBloke/NeuralHermes-2.5-Mistral-7B-GGUF/resolve/main/neuralhermes-2.5-mistral-7b.Q4_K_M.gguf", - "id": "neuralhermes-7b", - "object": "model", - "name": "NeuralHermes 7B", - "version": "1.0", - "description": "NeuralHermes 2.5 has been enhanced using Direct Preference Optimization. This fine-tuning, inspired by the RLHF process of Neural-chat-7b and OpenHermes-2.5-Mistral-7B, has led to improved performance across several benchmarks.", - "format": "gguf", - "settings": { - "ctx_len": 4096, - "system_prompt": "<|im_start|>system\n", - "user_prompt": "<|im_end|>\n<|im_start|>user\n", - "ai_prompt": "<|im_end|>\n<|im_start|>assistant\n" - }, - "parameters": { - "max_tokens": 4096 - }, - "metadata": { - "author": "Intel, The Bloke", - "tags": ["General Use", "Code", "Big Context Length"], - "size": 4370000000 - } - } - \ No newline at end of file diff --git a/models/noromaid-20b/model.json b/models/noromaid-20b/model.json index 86291e4f5..f6994d1ce 100644 --- a/models/noromaid-20b/model.json +++ b/models/noromaid-20b/model.json @@ -2,22 +2,22 @@ "source_url": "https://huggingface.co/TheBloke/Noromaid-20B-v0.1.1-GGUF/resolve/main/noromaid-20b-v0.1.1.Q4_K_M.gguf", "id": "noromaid-20b", "object": "model", - "name": "Noromaid 20B", + "name": "Noromaid 20B Q4", "version": "1.0", "description": "The Noromaid 20b model is designed for role-playing and general use, featuring a unique touch with the no_robots dataset that enhances human-like behavior.", "format": "gguf", "settings": { - "ctx_len": 4096, + "ctx_len": 2048, "system_prompt": "", - "user_prompt": "### Instruction: ", - "ai_prompt": "### Response: " + "user_prompt": "### Instruction:\n", + "ai_prompt": "### Response:\n" }, "parameters": { - "max_tokens": 4096 + "max_tokens": 2048 }, "metadata": { "author": "NeverSleep, The Bloke", - "tags": ["Role-playing"], + "tags": ["Medium", "Finetuned"], "size": 12040000000 } } diff --git a/models/openchat-7b/model.json b/models/openchat-7b/model.json deleted file mode 100644 index 1fd6bb259..000000000 --- a/models/openchat-7b/model.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "source_url": "https://huggingface.co/TheBloke/openchat_3.5-GGUF/resolve/main/openchat_3.5.Q4_K_M.gguf", - "id": "openchat-7b", - "object": "model", - "name": "Open Chat 3.5 7B", - "version": "1.0", - "description": "OpenChat represents a breakthrough in the realm of open-source language models. By implementing the C-RLFT fine-tuning strategy, inspired by offline reinforcement learning, this 7B model achieves results on par with ChatGPT (March).", - "format": "gguf", - "settings": { - "ctx_len": 4096, - "system_prompt": "", - "user_prompt": "GPT4 User: ", - "ai_prompt": "<|end_of_turn|>\nGPT4 Assistant: " - }, - "parameters": { - "max_tokens": 4096 - }, - "metadata": { - "author": "OpenChat, The Bloke", - "tags": ["General", "Code"], - "size": 4370000000 - } - } - \ No newline at end of file diff --git a/models/openhermes-mistral-7b/model.json b/models/openhermes-mistral-7b/model.json deleted file mode 100644 index 6b64363d5..000000000 --- a/models/openhermes-mistral-7b/model.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "source_url": "https://huggingface.co/TheBloke/OpenHermes-2.5-Mistral-7B-GGUF/resolve/main/openhermes-2.5-mistral-7b.Q4_K_M.gguf", - "id": "openhermes-mistral-7b", - "object": "model", - "name": "Openhermes 2.5 Mistral 7B", - "version": "1.0", - "description": "The OpenHermes 2.5 Mistral 7B incorporates additional code datasets, more than a million GPT-4 generated data examples, and other high-quality open datasets. This enhancement led to significant improvement in benchmarks, highlighting its improved skill in handling code-centric tasks.", - "format": "gguf", - "settings": { - "ctx_len": 4096, - "system_prompt": "<|im_start|>system\n", - "user_prompt": "<|im_end|>\n<|im_start|>user\n", - "ai_prompt": "<|im_end|>\n<|im_start|>assistant\n" - }, - "parameters": { - "max_tokens": 4096 - }, - "metadata": { - "author": "Teknium, The Bloke", - "tags": ["General", "Roleplay"], - "size": 4370000000 - } - } - \ No newline at end of file diff --git a/models/openhermes-neural-7b/model.json b/models/openhermes-neural-7b/model.json new file mode 100644 index 000000000..536345fd1 --- /dev/null +++ b/models/openhermes-neural-7b/model.json @@ -0,0 +1,24 @@ +{ + "source_url": "https://huggingface.co/TheBloke/OpenHermes-2.5-neural-chat-7B-v3-2-7B-GGUF/resolve/main/openhermes-2.5-neural-chat-7b-v3-2-7b.Q4_K_M.gguf", + "id": "openhermes-neural-7b", + "object": "model", + "name": "OpenHermes Neural 7B Q4", + "version": "1.0", + "description": "OpenHermes Neural is a merged model from OpenHermes-2.5-Mistral-7B and neural-chat-7b-v3-2 with the TIES method.", + "format": "gguf", + "settings": { + "ctx_len": 2048, + "system_prompt": "<|im_start|>system\n", + "user_prompt": "<|im_end|>\n<|im_start|>user\n", + "ai_prompt": "<|im_end|>\n<|im_start|>assistant\n" + }, + "parameters": { + "max_tokens": 2048 + }, + "metadata": { + "author": "Intel, The Bloke", + "tags": ["Recommended", "Small", "Merged"], + "size": 4370000000 + } + } + \ No newline at end of file diff --git a/models/openorca-13b/model.json b/models/openorca-13b/model.json index 02a555430..0c0c9fff7 100644 --- a/models/openorca-13b/model.json +++ b/models/openorca-13b/model.json @@ -2,22 +2,22 @@ "source_url": "https://huggingface.co/TheBloke/Orca-2-13B-GGUF/resolve/main/orca-2-13b.Q5_K_M.gguf", "id": "openorca-13b", "object": "model", - "name": "Orca 2 13B", + "name": "Orca 2 13B Q5", "version": "1.0", "description": "Orca 2 is a finetuned version of LLAMA-2, designed primarily for single-turn responses in reasoning, reading comprehension, math problem solving, and text summarization.", "format": "gguf", "settings": { - "ctx_len": 4096, + "ctx_len": 2048, "system_prompt": "<|im_start|>system\n", "user_prompt": "<|im_end|>\n<|im_start|>user\n", "ai_prompt": "<|im_end|>\n<|im_start|>assistant\n" }, "parameters": { - "max_tokens": 4096 + "max_tokens": 2048 }, "metadata": { "author": "Microsoft, The Bloke", - "tags": ["General Use"], + "tags": ["Medium", "Finetuned"], "size": 9230000000 } } diff --git a/models/openorca-7b/model.json b/models/openorca-7b/model.json deleted file mode 100644 index 42c88212c..000000000 --- a/models/openorca-7b/model.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "source_url": "https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-GGUF/resolve/main/mistral-7b-openorca.Q4_K_M.gguf", - "id": "openorca-7b", - "object": "model", - "name": "OpenOrca 7B", - "version": "1.0", - "description": "OpenOrca 8k 7B is a model based on Mistral 7B, fine-tuned using the OpenOrca dataset. Notably ranked first on the HF Leaderboard for models under 30B, it excels in efficiency and accessibility.", - "format": "gguf", - "settings": { - "ctx_len": 4096, - "system_prompt": "<|im_start|>system\n", - "user_prompt": "<|im_end|>\n<|im_start|>user\n", - "ai_prompt": "<|im_end|>\n<|im_start|>assistant\n" - }, - "parameters": { - "max_tokens": 4096 - }, - "metadata": { - "author": "OpenOrca, The Bloke", - "tags": ["General", "Code"], - "size": 4370000000 - } - } - \ No newline at end of file diff --git a/models/phind-34b/model.json b/models/phind-34b/model.json index 4391ae08d..bfbd4a9b5 100644 --- a/models/phind-34b/model.json +++ b/models/phind-34b/model.json @@ -2,22 +2,22 @@ "source_url": "https://huggingface.co/TheBloke/Phind-CodeLlama-34B-v2-GGUF/resolve/main/phind-codellama-34b-v2.Q5_K_M.gguf", "id": "phind-34b", "object": "model", - "name": "Phind 34B", + "name": "Phind 34B Q5", "version": "1.0", "description": "Phind-CodeLlama-34B-v2 is an AI model fine-tuned on 1.5B tokens of high-quality programming data. It's a SOTA open-source model in coding. This multi-lingual model excels in various programming languages, including Python, C/C++, TypeScript, Java, and is designed to be steerable and user-friendly.", "format": "gguf", "settings": { - "ctx_len": 4096, + "ctx_len": 2048, "system_prompt": "### System Prompt\n", "user_prompt": "### User Message\n", "ai_prompt": "### Assistant\n" }, "parameters": { - "max_tokens": 4096 + "max_tokens": 2048 }, "metadata": { "author": "Phind, The Bloke", - "tags": ["Code", "Big Context Length"], + "tags": ["Medium", "Finetuned"], "size": 24320000000 } } diff --git a/models/rocket-3b/model.json b/models/rocket-3b/model.json index b00eb1f44..c40ee6258 100644 --- a/models/rocket-3b/model.json +++ b/models/rocket-3b/model.json @@ -2,7 +2,7 @@ "source_url": "https://huggingface.co/TheBloke/rocket-3B-GGUF/resolve/main/rocket-3b.Q4_K_M.gguf", "id": "rocket-3b", "object": "model", - "name": "Rocket 3B", + "name": "Rocket 3B Q4", "version": "1.0", "description": "Rocket-3B is a GPT-like model, primarily English, fine-tuned on diverse public datasets. It outperforms larger models in benchmarks, showcasing superior understanding and text generation, making it an effective chat model for its size.", "format": "gguf", @@ -13,11 +13,11 @@ "ai_prompt": "<|im_end|>\n<|im_start|>assistant\n" }, "parameters": { - "max_tokens": 4096 + "max_tokens": 2048 }, "metadata": { - "author": "pansophic, The Bloke", - "tags": ["General Use"], + "author": "Pansophic, The Bloke", + "tags": ["Tiny", "Finetuned"], "size": 1710000000 } } \ No newline at end of file diff --git a/models/starling-7b/model.json b/models/starling-7b/model.json index c029ea7d9..1bc2aac61 100644 --- a/models/starling-7b/model.json +++ b/models/starling-7b/model.json @@ -2,22 +2,22 @@ "source_url": "https://huggingface.co/TheBloke/Starling-LM-7B-alpha-GGUF/resolve/main/starling-lm-7b-alpha.Q4_K_M.gguf", "id": "starling-7b", "object": "model", - "name": "Strarling alpha 7B", + "name": "Strarling alpha 7B Q4", "version": "1.0", "description": "Starling-RM-7B-alpha is a language model finetuned with Reinforcement Learning from AI Feedback from Openchat 3.5. It stands out for its impressive performance using GPT-4 as a judge, making it one of the top-performing models in its category.", "format": "gguf", "settings": { - "ctx_len": 4096, + "ctx_len": 2048, "system_prompt": "", "user_prompt": "GPT4 User: ", "ai_prompt": "<|end_of_turn|>\nGPT4 Assistant: " }, "parameters": { - "max_tokens": 4096 + "max_tokens": 2048 }, "metadata": { "author": "Berkeley-nest, The Bloke", - "tags": ["General", "Code"], + "tags": ["Recommended", "Small","Finetuned"], "size": 4370000000 } } diff --git a/models/storytelling-70b/model.json b/models/storytelling-70b/model.json deleted file mode 100644 index 76e6f7922..000000000 --- a/models/storytelling-70b/model.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "source_url": "https://huggingface.co/TheBloke/GOAT-70B-Storytelling-GGUF/resolve/main/goat-70b-storytelling.Q5_K_M.gguf", - "id": "storytelling-70b", - "object": "model", - "name": "Storytelling 70B", - "version": "1.0", - "description": "The GOAT-70B-Storytelling model is designed for autonomous story-writing, including crafting books and movie scripts. Based on the LLaMA 2 70B architecture, this model excels in generating cohesive and engaging narratives using inputs like plot outlines and character profiles.", - "format": "gguf", - "settings": { - "ctx_len": 4096, - "system_prompt": "", - "user_prompt": "### USER: ", - "ai_prompt": "\n### ASSISTANT: " - }, - "parameters": { - "max_tokens": 4096 - }, - "metadata": { - "author": "GOAT-AI, The Bloke", - "tags": ["General Use", "Writing"], - "size": 48750000000 - } - } - \ No newline at end of file diff --git a/models/tiefighter-13b/model.json b/models/tiefighter-13b/model.json index b1d354ce3..a28f88d85 100644 --- a/models/tiefighter-13b/model.json +++ b/models/tiefighter-13b/model.json @@ -2,22 +2,22 @@ "source_url": "https://huggingface.co/TheBloke/LLaMA2-13B-Tiefighter-GGUF/resolve/main/llama2-13b-tiefighter.Q5_K_M.gguf", "id": "tiefighter-13b", "object": "model", - "name": "Tiefighter 13B", + "name": "Tiefighter 13B Q5", "version": "1.0", "description": "Tiefighter-13B is a highly creative, merged AI model achieved by combining various 'LORAs' on top of an existing merge, particularly focusing on storytelling and improvisation. This model excels in story writing, chatbots, and adventuring, and is designed to perform better with less detailed inputs, leveraging its inherent creativity.", "format": "gguf", "settings": { - "ctx_len": 4096, + "ctx_len": 2048, "system_prompt": "", "user_prompt": "### Instruction: ", "ai_prompt": "\n### Response: " }, "parameters": { - "max_tokens": 4096 + "max_tokens": 2048 }, "metadata": { "author": "KoboldAI, The Bloke", - "tags": ["General Use", "Role-playing", "Writing"], + "tags": ["Medium", "Finetuned"], "size": 9230000000 } } diff --git a/models/tinyllama-1.1b/model.json b/models/tinyllama-1.1b/model.json index f561eb25d..ace0ca6a0 100644 --- a/models/tinyllama-1.1b/model.json +++ b/models/tinyllama-1.1b/model.json @@ -2,7 +2,7 @@ "source_url": "https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v0.6/resolve/main/ggml-model-q4_0.gguf", "id": "tinyllama-1.1b", "object": "model", - "name": "TinyLlama Chat 1.1B", + "name": "TinyLlama Chat 1.1B Q4", "version": "1.0", "description": "The TinyLlama project, featuring a 1.1B parameter Llama model, is pretrained on an expansive 3 trillion token dataset. Its design ensures easy integration with various Llama-based open-source projects. Despite its smaller size, it efficiently utilizes lower computational and memory resources, drawing on GPT-4's analytical prowess to enhance its conversational abilities and versatility.", "format": "gguf", @@ -17,7 +17,7 @@ }, "metadata": { "author": "TinyLlama", - "tags": ["General Use"], + "tags": ["Tiny", "Foundation Model"], "size": 637000000 } } \ No newline at end of file diff --git a/models/wizardcoder-13b/model.json b/models/wizardcoder-13b/model.json index 944b5632b..16f8946be 100644 --- a/models/wizardcoder-13b/model.json +++ b/models/wizardcoder-13b/model.json @@ -2,22 +2,22 @@ "source_url": "https://huggingface.co/TheBloke/WizardCoder-Python-13B-V1.0-GGUF/resolve/main/wizardcoder-python-13b-v1.0.Q5_K_M.gguf", "id": "wizardcoder-13b", "object": "model", - "name": "Wizard Coder Python 13B", + "name": "Wizard Coder Python 13B Q5", "version": "1.0", "description": "WizardCoder-Python-13B is a Python coding model major models like ChatGPT-3.5. This model based on the Llama2 architecture, demonstrate high proficiency in specific domains like coding and mathematics.", "format": "gguf", "settings": { - "ctx_len": 4096, + "ctx_len": 2048, "system_prompt": "", "user_prompt": "### Instruction:\n", "ai_prompt": "### Response:\n" }, "parameters": { - "max_tokens": 4096 + "max_tokens": 2048 }, "metadata": { "author": "WizardLM, The Bloke", - "tags": ["Code", "Big Context Length"], + "tags": ["Recommended", "Medium", "Finetuned"], "size": 9230000000 } } diff --git a/models/wizardcoder-34b/model.json b/models/wizardcoder-34b/model.json deleted file mode 100644 index aa2618e1b..000000000 --- a/models/wizardcoder-34b/model.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "source_url": "https://huggingface.co/TheBloke/WizardCoder-Python-34B-V1.0-GGUF/resolve/main/wizardcoder-python-34b-v1.0.Q5_K_M.gguf", - "id": "wizardcoder-34b", - "object": "model", - "name": "Wizard Coder Python 34B", - "version": "1.0", - "description": "WizardCoder-Python-34B is a Python coding model major models like ChatGPT-3.5. This model based on the Llama2 architecture, demonstrate high proficiency in specific domains like coding and mathematics.", - "format": "gguf", - "settings": { - "ctx_len": 4096, - "system_prompt": "", - "user_prompt": "### Instruction:\n", - "ai_prompt": "### Response:\n" - }, - "parameters": { - "max_tokens": 4096 - }, - "metadata": { - "author": "WizardLM, The Bloke", - "tags": ["Code", "Big Context Length"], - "size": 24320000000 - } - } - \ No newline at end of file diff --git a/models/xwin-70b/model.json b/models/xwin-70b/model.json deleted file mode 100644 index a5c1647b0..000000000 --- a/models/xwin-70b/model.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "source_url": "https://huggingface.co/TheBloke/Xwin-LM-70B-V0.1-GGUF/resolve/main/xwin-lm-70b-v0.1.Q5_K_M.gguf", - "id": "xwin-70b", - "object": "model", - "name": "Xwin LM 70B", - "version": "1.0", - "description": "Xwin-LM, based on Llama2 models, emphasizes alignment and exhibits advanced language understanding, text generation, and role-playing abilities.", - "format": "gguf", - "settings": { - "ctx_len": 4096, - "system_prompt": "", - "user_prompt": "USER: ", - "ai_prompt": "ASSISTANT: " - }, - "parameters": { - "max_tokens": 4096 - }, - "metadata": { - "author": "Xwin-LM, The Bloke", - "tags": ["General Use", "Role-playing"], - "size": 48750000000 - } - } - \ No newline at end of file diff --git a/models/yarn-70b/model.json b/models/yarn-70b/model.json deleted file mode 100644 index 67d8d3804..000000000 --- a/models/yarn-70b/model.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "source_url": "https://huggingface.co/TheBloke/Yarn-Llama-2-70B-32k-GGUF/resolve/main/yarn-llama-2-70b-32k.Q5_K_M.gguf", - "id": "yarn-70b", - "object": "model", - "name": "Yarn 32k 70B", - "version": "1,0", - "description": "Yarn-Llama-2-70b-32k is designed specifically for handling long contexts. It represents an extension of the Llama-2-70b-hf model, now supporting a 32k token context window.", - "format": "gguf", - "settings": { - "ctx_len": 4096 - }, - "parameters": { - "max_tokens": 4096 - }, - "metadata": { - "author": "NousResearch, The Bloke", - "tags": ["General Use", "Big Context Length"], - "size": 48750000000 - } - } - \ No newline at end of file diff --git a/models/yi-34b/model.json b/models/yi-34b/model.json index f899bc54b..c2d2fd327 100644 --- a/models/yi-34b/model.json +++ b/models/yi-34b/model.json @@ -2,22 +2,22 @@ "source_url": "https://huggingface.co/TheBloke/Yi-34B-Chat-GGUF/resolve/main/yi-34b-chat.Q5_K_M.gguf", "id": "yi-34b", "object": "model", - "name": "Yi 34B", + "name": "Yi 34B Q5", "version": "1.0", "description": "Yi-34B, a specialized chat model, is known for its diverse and creative responses and excels across various NLP tasks and benchmarks.", "format": "gguf", "settings": { - "ctx_len": 4096, + "ctx_len": 2048, "system_prompt": "<|im_start|>system\n", "user_prompt": "<|im_end|>\n<|im_start|>user\n", "ai_prompt": "<|im_end|>\n<|im_start|>assistant\n" }, "parameters": { - "max_tokens": 4096 + "max_tokens": 2048 }, "metadata": { "author": "01-ai, The Bloke", - "tags": ["General", "Role-playing", "Writing"], + "tags": ["Medium", "Foundational Model"], "size": 24320000000 } } diff --git a/models/zephyr-beta-7b/model.json b/models/zephyr-beta-7b/model.json index 24529bc9a..2e6689830 100644 --- a/models/zephyr-beta-7b/model.json +++ b/models/zephyr-beta-7b/model.json @@ -2,22 +2,22 @@ "source_url": "https://huggingface.co/TheBloke/zephyr-7B-beta-GGUF/resolve/main/zephyr-7b-beta.Q4_K_M.gguf", "id": "zephyr-beta-7b", "object": "model", - "name": "Zephyr Beta 7B", + "name": "Zephyr Beta 7B Q4", "version": "1.0", - "description": "The Zephyr-7B-β model marks the second iteration in the Zephyr series, designed to function as an effective assistant. It has been fine-tuned from the mistralai/Mistral-7B-v0.1 base model, utilizing a combination of public and synthetic datasets with the application of Direct Preference Optimization.", + "description": "The Zephyr-7B-β model is trained by HuggingFace, designed to function as a practical assistant. It has been fine-tuned from the mistralai/Mistral-7B-v0.1 base model, utilizing a combination of public and synthetic datasets with the application of Direct Preference Optimization.", "format": "gguf", "settings": { - "ctx_len": 4096, + "ctx_len": 2048, "system_prompt": "<|system|>\n", "user_prompt": "\n<|user|>\n", "ai_prompt": "\n<|assistant|>\n" }, "parameters": { - "max_tokens": 4096 + "max_tokens": 2048 }, "metadata": { "author": "HuggingFaceH4, The Bloke", - "tags": ["General Use", "Big Context Length"], + "tags": ["Small", "Finetuned"], "size": 4370000000 } } diff --git a/server/.gitignore b/server/.gitignore new file mode 100644 index 000000000..6320cd248 --- /dev/null +++ b/server/.gitignore @@ -0,0 +1 @@ +data \ No newline at end of file diff --git a/server/data/.gitkeep b/server/data/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/server/data/models/.gitkeep b/server/data/models/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/server/data/threads/.gitkeep b/server/data/threads/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/server/icons/icon.png b/server/icons/icon.png new file mode 100644 index 000000000..289f99ded Binary files /dev/null and b/server/icons/icon.png differ diff --git a/server/lib/.gitkeep b/server/lib/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/server/main.ts b/server/main.ts new file mode 100644 index 000000000..707c3fb4b --- /dev/null +++ b/server/main.ts @@ -0,0 +1,19 @@ +import fastify from 'fastify' +import dotenv from 'dotenv' +import v1API from './v1' +const server = fastify() + +dotenv.config() +server.register(v1API, {prefix: "/api/v1"}) + + +const JAN_API_PORT = Number.parseInt(process.env.JAN_API_PORT || '1337') +const JAN_API_HOST = process.env.JAN_API_HOST || "0.0.0.0" + +server.listen({ + port: JAN_API_PORT, + host: JAN_API_HOST +}).then(() => { + console.log(`JAN API listening at: http://${JAN_API_HOST}:${JAN_API_PORT}`); +}) + diff --git a/server/nodemon.json b/server/nodemon.json new file mode 100644 index 000000000..0ea41ca96 --- /dev/null +++ b/server/nodemon.json @@ -0,0 +1,5 @@ +{ + "watch": ["main.ts", "v1"], + "ext": "ts, json", + "exec": "tsc && node ./build/main.js" +} \ No newline at end of file diff --git a/server/package.json b/server/package.json new file mode 100644 index 000000000..1fd06a482 --- /dev/null +++ b/server/package.json @@ -0,0 +1,32 @@ +{ + "name": "jan-server", + "version": "0.1.3", + "main": "./build/main.js", + "author": "Jan ", + "license": "AGPL-3.0", + "homepage": "https://jan.ai", + "description": "Use offline LLMs with your own data. Run open source models like Llama2 or Falcon on your internal computers/servers.", + "build": "", + "scripts": { + "lint": "eslint . --ext \".js,.jsx,.ts,.tsx\"", + "test:e2e": "playwright test --workers=1", + "dev": "nodemon .", + "build": "tsc" + }, + "dependencies": { + }, + "devDependencies": { + "@types/body-parser": "^1.19.5", + "@types/npmcli__arborist": "^5.6.4", + "@typescript-eslint/eslint-plugin": "^6.7.3", + "@typescript-eslint/parser": "^6.7.3", + "dotenv": "^16.3.1", + "eslint-plugin-react": "^7.33.2", + "fastify": "^4.24.3", + "nodemon": "^3.0.1", + "run-script-os": "^1.1.6" + }, + "installConfig": { + "hoistingLimits": "workspaces" + } +} diff --git a/server/tsconfig.json b/server/tsconfig.json new file mode 100644 index 000000000..3363fdba6 --- /dev/null +++ b/server/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "target": "es5", + "module": "commonjs", + "noImplicitAny": true, + "sourceMap": true, + "strict": true, + "outDir": "./build", + "rootDir": "./", + "noEmitOnError": true, + "esModuleInterop": true, + "baseUrl": ".", + "allowJs": true, + "skipLibCheck": true, + "paths": { "*": ["node_modules/*"] }, + "typeRoots": ["node_modules/@types"] + }, + // "sourceMap": true, + + "include": ["./**/*.ts"], + "exclude": ["core", "build", "dist", "tests", "node_modules"] +} diff --git a/server/v1/assistants/index.ts b/server/v1/assistants/index.ts new file mode 100644 index 000000000..c722195d0 --- /dev/null +++ b/server/v1/assistants/index.ts @@ -0,0 +1,8 @@ +import { FastifyInstance, FastifyPluginAsync, FastifyPluginOptions } from 'fastify' + +const router: FastifyPluginAsync = async (app: FastifyInstance, opts: FastifyPluginOptions) => { + //TODO: Add controllers for assistants here + // app.get("/", controller) + // app.post("/", controller) +} +export default router; \ No newline at end of file diff --git a/server/v1/chat/index.ts b/server/v1/chat/index.ts new file mode 100644 index 000000000..cb5fbf120 --- /dev/null +++ b/server/v1/chat/index.ts @@ -0,0 +1,11 @@ +import { FastifyInstance, FastifyPluginAsync, FastifyPluginOptions } from 'fastify' + +const router: FastifyPluginAsync = async (app: FastifyInstance, opts: FastifyPluginOptions) => { + //TODO: Add controllers for here + // app.get("/", controller) + + app.post("/", (req, res) => { + req.body + }) +} +export default router; \ No newline at end of file diff --git a/server/v1/index.ts b/server/v1/index.ts new file mode 100644 index 000000000..89d73200b --- /dev/null +++ b/server/v1/index.ts @@ -0,0 +1,37 @@ +import assistantsAPI from './assistants' +import chatCompletionAPI from './chat' +import modelsAPI from './models' +import threadsAPI from './threads' + +import { FastifyInstance, FastifyPluginAsync } from 'fastify' + +const router: FastifyPluginAsync = async (app: FastifyInstance, opts) => { + app.register( + assistantsAPI, + { + prefix: "/assistants" + } + ) + + app.register( + chatCompletionAPI, + { + prefix: "/chat/completion" + } + ) + + app.register( + modelsAPI, + { + prefix: "/models" + } + ) + + app.register( + threadsAPI, + { + prefix: "/threads" + } + ) +} +export default router; \ No newline at end of file diff --git a/server/v1/models/downloadModel.ts b/server/v1/models/downloadModel.ts new file mode 100644 index 000000000..d564a2207 --- /dev/null +++ b/server/v1/models/downloadModel.ts @@ -0,0 +1,23 @@ +import { RouteHandlerMethod, FastifyRequest, FastifyReply } from 'fastify' +import { MODEL_FOLDER_PATH } from "./index" +import fs from 'fs/promises' + +const controller: RouteHandlerMethod = async (req: FastifyRequest, res: FastifyReply) => { + //TODO: download models impl + //Mirror logic from JanModelExtension.downloadModel? + let model = req.body.model; + + // Fetching logic + // const directoryPath = join(MODEL_FOLDER_PATH, model.id) + // await fs.mkdir(directoryPath) + + // const path = join(directoryPath, model.id) + // downloadFile(model.source_url, path) + // TODO: Different model downloader from different model vendor + + res.status(200).send({ + status: "Ok" + }) +} + +export default controller; \ No newline at end of file diff --git a/server/v1/models/index.ts b/server/v1/models/index.ts new file mode 100644 index 000000000..22c551300 --- /dev/null +++ b/server/v1/models/index.ts @@ -0,0 +1,61 @@ + +export const MODEL_FOLDER_PATH = "./data/models" +export const _modelMetadataFileName = 'model.json' + +import fs from 'fs/promises' +import { Model } from '@janhq/core' +import { join } from 'path' + +// map string => model object +let modelIndex = new Map(); +async function buildModelIndex(){ + let modelIds = await fs.readdir(MODEL_FOLDER_PATH); + // TODO: read modelFolders to get model info, mirror JanModelExtension? + try{ + for(let modelId in modelIds){ + let path = join(MODEL_FOLDER_PATH, modelId) + let fileData = await fs.readFile(join(path, _modelMetadataFileName)) + modelIndex.set(modelId, JSON.parse(fileData.toString("utf-8")) as Model) + } + } + catch(err){ + console.error("build model index failed. ", err); + } +} +buildModelIndex() + +import { FastifyInstance, FastifyPluginAsync, FastifyPluginOptions } from 'fastify' +import downloadModelController from './downloadModel' +import { startModel, stopModel } from './modelOp' + +const router: FastifyPluginAsync = async (app: FastifyInstance, opts: FastifyPluginOptions) => { + //TODO: Add controllers declaration here + + ///////////// CRUD //////////////// + // Model listing + app.get("/", async (req, res) => { + res.status(200).send( + modelIndex.values() + ) + }) + + // Retrieve model info + app.get("/:id", (req, res) => { + res.status(200).send( + modelIndex.get(req.params.id) + ) + }) + + // Delete model + app.delete("/:id", (req, res) => { + modelIndex.delete(req.params) + + // TODO: delete on disk + }) + + ///////////// Other ops //////////////// + app.post("/", downloadModelController) + app.put("/start", startModel) + app.put("/stop", stopModel) +} +export default router; \ No newline at end of file diff --git a/server/v1/models/modelOp.ts b/server/v1/models/modelOp.ts new file mode 100644 index 000000000..f2c7ffe75 --- /dev/null +++ b/server/v1/models/modelOp.ts @@ -0,0 +1,11 @@ +import {FastifyRequest, FastifyReply} from 'fastify' + +export async function startModel(req: FastifyRequest, res: FastifyReply): Promise { + + +} + +export async function stopModel(req: FastifyRequest, res: FastifyReply): Promise { + + +} \ No newline at end of file diff --git a/server/v1/threads/index.ts b/server/v1/threads/index.ts new file mode 100644 index 000000000..e63f9e8d8 --- /dev/null +++ b/server/v1/threads/index.ts @@ -0,0 +1,8 @@ +import { FastifyInstance, FastifyPluginAsync, FastifyPluginOptions } from 'fastify' + +const router: FastifyPluginAsync = async (app: FastifyInstance, opts: FastifyPluginOptions) => { + //TODO: Add controllers declaration here + + // app.get() +} +export default router; \ No newline at end of file diff --git a/uikit/src/badge/index.tsx b/uikit/src/badge/index.tsx index a2eeaac2d..387932ff0 100644 --- a/uikit/src/badge/index.tsx +++ b/uikit/src/badge/index.tsx @@ -10,6 +10,7 @@ const badgeVariants = cva('badge', { secondary: 'badge-secondary', danger: 'badge-danger', outline: 'badge-outline', + pink: 'badge-pink', }, }, defaultVariants: { diff --git a/uikit/src/badge/styles.scss b/uikit/src/badge/styles.scss index cf8e52c8b..77feb0769 100644 --- a/uikit/src/badge/styles.scss +++ b/uikit/src/badge/styles.scss @@ -2,7 +2,11 @@ @apply focus:ring-ring border-border inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2; &-primary { - @apply bg-primary text-primary-foreground hover:bg-primary/80 border-transparent; + @apply border-transparent bg-blue-100 text-blue-600; + } + + &-pink { + @apply border-transparent bg-pink-100 text-pink-700; } &-success { @@ -14,7 +18,7 @@ } &-danger { - @apply bg-danger text-danger-foreground hover:bg-danger/80 border-transparent; + @apply border-transparent bg-red-100 text-red-700; } &-outline { diff --git a/uikit/src/button/index.tsx b/uikit/src/button/index.tsx index 943e2bc34..7561b5c73 100644 --- a/uikit/src/button/index.tsx +++ b/uikit/src/button/index.tsx @@ -13,7 +13,9 @@ const buttonVariants = cva('btn', { danger: 'btn-danger', outline: 'btn-outline', secondary: 'btn-secondary', + secondaryBlue: 'btn-secondary-blue', ghost: 'btn-ghost', + success: 'btn-success', }, size: { sm: 'btn-sm', diff --git a/uikit/src/button/styles.scss b/uikit/src/button/styles.scss index 69d8e522e..481508841 100644 --- a/uikit/src/button/styles.scss +++ b/uikit/src/button/styles.scss @@ -1,5 +1,5 @@ .btn { - @apply inline-flex items-center justify-center whitespace-nowrap rounded-md font-semibold transition-colors; + @apply inline-flex items-center justify-center whitespace-nowrap rounded-lg font-semibold transition-colors; @apply focus-visible:ring-ring cursor-pointer focus-visible:outline-none focus-visible:ring-1; @apply disabled:pointer-events-none disabled:opacity-50; @@ -7,6 +7,10 @@ @apply bg-primary hover:bg-primary/90 text-white; } + &-secondary-blue { + @apply bg-blue-200 text-blue-900 hover:bg-blue-500/80; + } + &-danger { @apply bg-danger text-danger-foreground hover:bg-danger/90; } @@ -19,6 +23,10 @@ @apply bg-secondary text-secondary-foreground hover:bg-secondary/80; } + &-success { + @apply bg-green-500 text-white hover:bg-green-500/80; + } + &-ghost { @apply hover:bg-primary hover:text-primary-foreground; } @@ -58,6 +66,9 @@ &.btn-secondary { @apply bg-secondary hover:bg-secondary/80; } + &.btn-secondary-blue { + @apply bg-blue-200 text-blue-900 hover:bg-blue-200/80; + } &.btn-danger { @apply bg-danger hover:bg-danger/90; } diff --git a/uikit/src/select/styles.scss b/uikit/src/select/styles.scss index a0bf625f0..2c9c03333 100644 --- a/uikit/src/select/styles.scss +++ b/uikit/src/select/styles.scss @@ -1,5 +1,5 @@ .select { - @apply ring-offset-background placeholder:text-muted-foreground border-border flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border bg-transparent px-3 py-2 text-sm shadow-sm disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1; + @apply placeholder:text-muted-foreground border-border flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border bg-transparent px-3 py-2 text-sm shadow-sm disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1; &-caret { @apply h-4 w-4 opacity-50; @@ -18,7 +18,7 @@ } &-item { - @apply hover:bg-secondary relative my-1 block w-full cursor-pointer select-none items-center rounded-sm px-4 py-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50; + @apply hover:bg-secondary relative my-1 block w-full cursor-pointer select-none items-center rounded-sm px-4 py-2 text-sm data-[disabled]:pointer-events-none data-[disabled]:opacity-50; } &-trigger-viewport { diff --git a/web/containers/CardSidebar/index.tsx b/web/containers/CardSidebar/index.tsx index 38264e457..c26033367 100644 --- a/web/containers/CardSidebar/index.tsx +++ b/web/containers/CardSidebar/index.tsx @@ -48,8 +48,8 @@ export default function CardSidebar({ > {title} diff --git a/web/containers/DropdownListSidebar/index.tsx b/web/containers/DropdownListSidebar/index.tsx index 589847fdf..249c06588 100644 --- a/web/containers/DropdownListSidebar/index.tsx +++ b/web/containers/DropdownListSidebar/index.tsx @@ -19,6 +19,7 @@ import { twMerge } from 'tailwind-merge' import { MainViewState } from '@/constants/screens' +import { useActiveModel } from '@/hooks/useActiveModel' import { getDownloadedModels } from '@/hooks/useGetDownloadedModels' import { useMainViewState } from '@/hooks/useMainViewState' @@ -35,6 +36,7 @@ export default function DropdownListSidebar() { const activeThread = useAtomValue(activeThreadAtom) const [selected, setSelected] = useState() const { setMainViewState } = useMainViewState() + const { activeModel, stateModel } = useActiveModel() useEffect(() => { getDownloadedModels().then((downloadedModels) => { @@ -42,18 +44,22 @@ export default function DropdownListSidebar() { if (downloadedModels.length > 0) { setSelected( downloadedModels.filter( - (x) => x.id === activeThread?.assistants[0].model.id + (x) => + x.id === activeThread?.assistants[0].model.id || + x.id === activeModel?.id )[0] || downloadedModels[0] ) setSelectedModel( downloadedModels.filter( - (x) => x.id === activeThread?.assistants[0].model.id + (x) => + x.id === activeThread?.assistants[0].model.id || + x.id === activeModel?.id )[0] || downloadedModels[0] ) } }) // eslint-disable-next-line react-hooks/exhaustive-deps - }, [activeThread]) + }, [activeThread, activeModel, stateModel.loading]) return ( { + setsearchValue(e.target.value) + }} + /> + + +
+
+ {/* Temporary hide tabs */} + {/*
+
setTabActive('Model')} + > + + Model +
+ + +
setTabActive('Assistant')} + > + + Assistant +
+
+ + Coming Soon + + +
+
*/} + + +
+ +
+ +
+