forked from Shinonome/dots-hyprland
Add left sidebar translation
This commit is contained in:
@@ -11,6 +11,7 @@ import { ConfigToggle, ConfigSegmentedSelection, ConfigGap } from '../../.common
|
||||
import { markdownTest } from '../../.miscutils/md2pango.js';
|
||||
import { MarginRevealer } from '../../.widgethacks/advancedrevealers.js';
|
||||
import { chatEntry } from '../apiwidgets.js';
|
||||
import { getString } from '../../../i18n/i18n.js';
|
||||
|
||||
const MODEL_NAME = `Gemini`;
|
||||
|
||||
@@ -34,7 +35,7 @@ const GeminiInfo = () => {
|
||||
className: 'txt txt-title-small sidebar-chat-welcome-txt',
|
||||
wrap: true,
|
||||
justify: Gtk.Justification.CENTER,
|
||||
label: 'Assistant (Gemini)',
|
||||
label: `${getString('Assistant')} (Gemini)`,
|
||||
}),
|
||||
Box({
|
||||
className: 'spacing-h-5',
|
||||
@@ -44,12 +45,12 @@ const GeminiInfo = () => {
|
||||
className: 'txt-smallie txt-subtext',
|
||||
wrap: true,
|
||||
justify: Gtk.Justification.CENTER,
|
||||
label: 'Powered by Google',
|
||||
label: getString('Powered by Google'),
|
||||
}),
|
||||
Button({
|
||||
className: 'txt-subtext txt-norm icon-material',
|
||||
label: 'info',
|
||||
tooltipText: 'Uses gemini-pro.\nNot affiliated, endorsed, or sponsored by Google.\n\nPrivacy: Chat messages aren\'t linked to your account,\n but will be read by human reviewers to improve the model.',
|
||||
tooltipText: getString("Uses gemini-pro.\nNot affiliated, endorsed, or sponsored by Google.\n\nPrivacy: Chat messages aren't linked to your account,\n but will be read by human reviewers to improve the model."),
|
||||
setup: setupCursorHoverInfo,
|
||||
}),
|
||||
]
|
||||
@@ -77,11 +78,11 @@ export const GeminiSettings = () => MarginRevealer({
|
||||
hpack: 'center',
|
||||
icon: 'casino',
|
||||
name: 'Randomness',
|
||||
desc: 'Gemini\'s temperature value.\n Precise = 0\n Balanced = 0.5\n Creative = 1',
|
||||
desc: getString("Gemini's temperature value.\n Precise = 0\n Balanced = 0.5\n Creative = 1"),
|
||||
options: [
|
||||
{ value: 0.00, name: 'Precise', },
|
||||
{ value: 0.50, name: 'Balanced', },
|
||||
{ value: 1.00, name: 'Creative', },
|
||||
{ value: 0.00, name: getString('Precise'), },
|
||||
{ value: 0.50, name: getString('Balanced'), },
|
||||
{ value: 1.00, name: getString('Creative'), },
|
||||
],
|
||||
initIndex: 2,
|
||||
onChange: (value, name) => {
|
||||
@@ -96,8 +97,8 @@ export const GeminiSettings = () => MarginRevealer({
|
||||
children: [
|
||||
ConfigToggle({
|
||||
icon: 'model_training',
|
||||
name: 'Enhancements',
|
||||
desc: 'Tells Gemini:\n- It\'s a Linux sidebar assistant\n- Be brief and use bullet points',
|
||||
name: getString('Enhancements'),
|
||||
desc: getString("Tells Gemini:\n- It's a Linux sidebar assistant\n- Be brief and use bullet points"),
|
||||
initValue: GeminiService.assistantPrompt,
|
||||
onChange: (self, newValue) => {
|
||||
GeminiService.assistantPrompt = newValue;
|
||||
@@ -105,8 +106,8 @@ export const GeminiSettings = () => MarginRevealer({
|
||||
}),
|
||||
ConfigToggle({
|
||||
icon: 'shield',
|
||||
name: 'Safety',
|
||||
desc: 'When turned off, tells the API (not the model) \nto not block harmful/explicit content',
|
||||
name: getString('Safety'),
|
||||
desc: getString("When turned off, tells the API (not the model) \nto not block harmful/explicit content"),
|
||||
initValue: GeminiService.safe,
|
||||
onChange: (self, newValue) => {
|
||||
GeminiService.safe = newValue;
|
||||
@@ -114,8 +115,8 @@ export const GeminiSettings = () => MarginRevealer({
|
||||
}),
|
||||
ConfigToggle({
|
||||
icon: 'history',
|
||||
name: 'History',
|
||||
desc: 'Saves chat history\nMessages in previous chats won\'t show automatically, but they are there',
|
||||
name: getString('History'),
|
||||
desc: getString("Saves chat history\nMessages in previous chats won't show automatically, but they are there"),
|
||||
initValue: GeminiService.useHistory,
|
||||
onChange: (self, newValue) => {
|
||||
GeminiService.useHistory = newValue;
|
||||
@@ -223,7 +224,7 @@ export const sendMessage = (text) => {
|
||||
clearChat();
|
||||
GeminiService.loadHistory();
|
||||
}
|
||||
else if (text.startsWith('/model')) chatContent.add(SystemMessage(`Currently using \`${GeminiService.modelName}\``, '/model', geminiView))
|
||||
else if (text.startsWith('/model')) chatContent.add(SystemMessage(`${getString("Currently using")} \`${GeminiService.modelName}\``, '/model', geminiView))
|
||||
else if (text.startsWith('/prompt')) {
|
||||
const firstSpaceIndex = text.indexOf(' ');
|
||||
const prompt = text.slice(firstSpaceIndex + 1);
|
||||
@@ -237,18 +238,18 @@ export const sendMessage = (text) => {
|
||||
else if (text.startsWith('/key')) {
|
||||
const parts = text.split(' ');
|
||||
if (parts.length == 1) chatContent.add(SystemMessage(
|
||||
`Key stored in:\n\`${GeminiService.keyPath}\`\nTo update this key, type \`/key YOUR_API_KEY\``,
|
||||
`${getString("Key stored in:")} \n\`${GeminiService.keyPath}\`\n${getString("To update this key, type")} \`/key YOUR_API_KEY\``,
|
||||
'/key',
|
||||
geminiView));
|
||||
else {
|
||||
GeminiService.key = parts[1];
|
||||
chatContent.add(SystemMessage(`Updated API Key at\n\`${GeminiService.keyPath}\``, '/key', geminiView));
|
||||
chatContent.add(SystemMessage(`${getString("Updated API Key at")}\n\`${GeminiService.keyPath}\``, '/key', geminiView));
|
||||
}
|
||||
}
|
||||
else if (text.startsWith('/test'))
|
||||
chatContent.add(SystemMessage(markdownTest, `Markdown test`, geminiView));
|
||||
else
|
||||
chatContent.add(SystemMessage(`Invalid command.`, 'Error', geminiView))
|
||||
chatContent.add(SystemMessage(getString(`Invalid command.`), 'Error', geminiView))
|
||||
}
|
||||
else {
|
||||
GeminiService.send(text);
|
||||
@@ -280,7 +281,7 @@ export const geminiView = Box({
|
||||
// Always scroll to bottom with new content
|
||||
const adjustment = scrolledWindow.get_vadjustment();
|
||||
adjustment.connect("changed", () => Utils.timeout(1, () => {
|
||||
if(!chatEntry.hasFocus) return;
|
||||
if (!chatEntry.hasFocus) return;
|
||||
adjustment.set_value(adjustment.get_upper() - adjustment.get_page_size());
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user