generate title in user's language

fixes #178
This commit is contained in:
Jing Hua 2023-04-01 12:01:30 +08:00
parent 7cb8aa0b4a
commit d2da2a3b7c

View file

@ -9,7 +9,7 @@ import { _defaultChatConfig } from '@constants/chat';
import { officialAPIEndpoint } from '@constants/auth';
const useSubmit = () => {
const { t } = useTranslation('api');
const { t, i18n } = useTranslation('api');
const error = useStore((state) => state.error);
const setError = useStore((state) => state.setError);
const apiEndpoint = useStore((state) => state.apiEndpoint);
@ -156,7 +156,7 @@ const useSubmit = () => {
const message: MessageInterface = {
role: 'user',
content: `Generate a title in less than 6 words for the following message:\nUser: ${user_message}\nAssistant: ${assistant_message}`,
content: `Generate a title in less than 6 words for the following message (language: ${i18n.language}):\n"""\nUser: ${user_message}\nAssistant: ${assistant_message}\n"""`,
};
let title = (await generateTitle([message])).trim();