Skip to content

Commit ef81281

Browse files
authored
feat(chat): move to codegemma chat model (#46)
1 parent af62527 commit ef81281

File tree

3 files changed

+12
-37
lines changed

3 files changed

+12
-37
lines changed

‎src/common/download/index.ts

+2-12
Original file line numberDiff line numberDiff line change
@@ -164,20 +164,10 @@ const getModelInfo = async (
164164
checksum:
165165
"eb00372705e7d5d30442750e8a7c72919c8e243bee52e1cce97fcfc1008c6143",
166166
},
167-
"chat-small": {
168-
url: "https://huggingface.co/TheBloke/deepseek-coder-1.3b-instruct-GGUF/resolve/main/deepseek-coder-1.3b-instruct.Q8_0.gguf",
169-
checksum:
170-
"36eb025121a50ee6d37fe900659393ff8fb5ea34adc0e3c11fc635e07624dcdb",
171-
},
172167
"chat-medium": {
173-
url: "https://huggingface.co/TheBloke/deepseek-coder-6.7B-instruct-GGUF/resolve/main/deepseek-coder-6.7b-instruct.Q8_0.gguf",
174-
checksum:
175-
"02cd6ce7ccec670cf6d3dd147932f13e584f9e964d5a3297a74b401b658471ae",
176-
},
177-
"chat-large": {
178-
url: "https://huggingface.co/TheBloke/deepseek-coder-33B-instruct-GGUF/resolve/main/deepseek-coder-33b-instruct.Q8_0.gguf",
168+
url: "https://huggingface.co/lmstudio-community/codegemma-1.1-7b-it-GGUF/resolve/main/codegemma-1.1-7b-it-Q5_K_M.gguf",
179169
checksum:
180-
"86529f8eefc87a80bd20d62229ee5acdc32d5773be8575a143bc491924865c21",
170+
"ec11bacb9e0b8c8e0f483f209c487939202b04bbf4f815f0a0945c5b256da895",
181171
},
182172
};
183173

‎src/common/prompt/promptChat.ts

+10-17
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,22 @@ export type Chat = {
1111
title: string;
1212
};
1313

14-
const promptBaseDefault = `You are an AI programming assistant, utilizing the DeepSeek Coder model, developed by DeepSeek Company, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer.
15-
`;
16-
1714
export const getPromptChat = (chatMessages: ChatMessage[]) => {
15+
const systemPrompt =
16+
chatMessages.find((message) => message.role === "system")?.content || "";
1817
const promptHistory = chatMessages
1918
.filter((chatMessage) => chatMessage.role !== "system")
20-
.map((chatMessage) => {
19+
.map((chatMessage, index) => {
2120
const partOfPrompt =
22-
chatMessage.role === "user" ? "### Instruction:\n" : "### Response:\n";
23-
return (
24-
partOfPrompt +
25-
chatMessage.content +
26-
"\n" +
27-
(chatMessage.role === "ai" ? "<|EOT|>" : "")
28-
);
21+
index === 0 && chatMessage.role === "user"
22+
? "<start_of_turn>user\n" + systemPrompt + "\n"
23+
: chatMessage.role === "user"
24+
? "<start_of_turn>user\n"
25+
: "<start_of_turn>model\n";
26+
return partOfPrompt + chatMessage.content + "<end_of_turn>\n";
2927
})
3028
.join("");
3129

32-
const promptBase =
33-
chatMessages.find((message) => message.role === "system")?.content ??
34-
promptBaseDefault;
35-
36-
const prompt = promptBase + promptHistory + "### Response:\n";
37-
30+
const prompt = "<bos>" + promptHistory + "<start_of_turn>model\n";
3831
return prompt;
3932
};

‎src/common/server/index.ts

-8
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,9 @@ const modelsBase = {
1818
export type TypeModelsBase = keyof typeof modelsBase;
1919

2020
export const modelsChat = {
21-
"chat-small": {
22-
port: 39725,
23-
},
2421
"chat-medium": {
2522
port: 39726,
2623
},
27-
"chat-large": {
28-
port: 39727,
29-
},
3024
};
3125

3226
export type TypeModelsChat = keyof typeof modelsChat;
@@ -311,7 +305,5 @@ class Server {
311305
export const servers = {
312306
"base-small": new Server("base-small"),
313307
"base-medium": new Server("base-medium"),
314-
"chat-small": new Server("chat-small"),
315308
"chat-medium": new Server("chat-medium"),
316-
"chat-large": new Server("chat-large"),
317309
};

0 commit comments

Comments
 (0)