Feat: Settings for learning lang (#641)
* refactor settings * refactor constants * add settings for native/learning language * setup langugage for transcribe * use 2 letter code for echogarden * AI commands support multiple language * update languages constant * fix sentry error * fix context menu * show camdict when only learning English * add en-GB * recording assess support multiple languages * fix ai command * refactor
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import { ChatPromptTemplate } from "@langchain/core/prompts";
|
||||
import { textCommand } from "./text.command";
|
||||
import { LANGUAGES } from "@/constants";
|
||||
|
||||
export const summarizeTopicCommand = async (
|
||||
text: string,
|
||||
learningLanguage: string,
|
||||
options: {
|
||||
key: string;
|
||||
modelName?: string;
|
||||
@@ -15,10 +17,12 @@ export const summarizeTopicCommand = async (
|
||||
const prompt = await ChatPromptTemplate.fromMessages([
|
||||
["system", SYSTEM_PROMPT],
|
||||
["human", text],
|
||||
]).format({});
|
||||
]).format({
|
||||
learning_language: LANGUAGES.find((l) => l.code === learningLanguage).name,
|
||||
});
|
||||
|
||||
return textCommand(prompt, options);
|
||||
};
|
||||
|
||||
const SYSTEM_PROMPT =
|
||||
"Please generate a four to five word title summarizing our conversation without any lead-in, punctuation, quotation marks, periods, symbols, bold text, or additional text. Remove enclosing quotation marks.";
|
||||
"Please generate a four to five words title summarizing our conversation in {learning_language} without any lead-in, punctuation, quotation marks, periods, symbols, bold text, or additional text. Remove enclosing quotation marks.";
|
||||
|
||||
Reference in New Issue
Block a user