forked from Shinonome/dots-hyprland
improve history
This commit is contained in:
@@ -7,6 +7,8 @@ let configOptions = {
|
||||
'ai': {
|
||||
'defaultGPTProvider': "openai",
|
||||
'defaultTemperature': 0.9,
|
||||
'enhancements': true,
|
||||
'useHistory': true,
|
||||
'writingCursor': " ...", // Warning: Using weird characters can mess up Markdown rendering
|
||||
},
|
||||
'animations': {
|
||||
|
||||
@@ -89,7 +89,7 @@ export const GeminiSettings = () => MarginRevealer({
|
||||
GeminiService.temperature = value;
|
||||
},
|
||||
}),
|
||||
ConfigGap({ vertical: true, size: 10 }), // Note: size can only be 5, 10, or 15
|
||||
ConfigGap({ vertical: true, size: 10 }), // Note: size can only be 5, 10, or 15
|
||||
Box({
|
||||
vertical: true,
|
||||
hpack: 'fill',
|
||||
@@ -104,6 +104,15 @@ export const GeminiSettings = () => MarginRevealer({
|
||||
GeminiService.assistantPrompt = newValue;
|
||||
},
|
||||
}),
|
||||
ConfigToggle({
|
||||
icon: 'history',
|
||||
name: 'History',
|
||||
desc: 'Saves chat history',
|
||||
initValue: GeminiService.useHistory,
|
||||
onChange: (self, newValue) => {
|
||||
GeminiService.useHistory = newValue;
|
||||
},
|
||||
}),
|
||||
]
|
||||
})
|
||||
]
|
||||
@@ -201,6 +210,10 @@ export const sendMessage = (text) => {
|
||||
// Commands
|
||||
if (text.startsWith('/')) {
|
||||
if (text.startsWith('/clear')) clearChat();
|
||||
else if (text.startsWith('/load')) {
|
||||
clearChat();
|
||||
GeminiService.loadHistory();
|
||||
}
|
||||
else if (text.startsWith('/model')) chatContent.add(SystemMessage(`Currently using \`${GeminiService.modelName}\``, '/model', geminiView))
|
||||
else if (text.startsWith('/prompt')) {
|
||||
const firstSpaceIndex = text.indexOf(' ');
|
||||
@@ -257,10 +270,10 @@ export const geminiView = Box({
|
||||
})
|
||||
// Always scroll to bottom with new content
|
||||
const adjustment = scrolledWindow.get_vadjustment();
|
||||
adjustment.connect("changed", () => {
|
||||
adjustment.connect("changed", () => Utils.timeout(1, () => {
|
||||
if(!chatEntry.hasFocus) return;
|
||||
adjustment.set_value(adjustment.get_upper() - adjustment.get_page_size());
|
||||
})
|
||||
}))
|
||||
}
|
||||
})]
|
||||
});
|
||||
Reference in New Issue
Block a user