add ask gemini button in search

This commit is contained in:
end-4
2024-04-08 18:11:35 +07:00
parent f3f41538e3
commit 6eee9f4418
2 changed files with 19 additions and 3 deletions
+14 -1
View File
@@ -5,6 +5,7 @@ import * as Utils from 'resource:///com/github/Aylur/ags/utils.js';
const { execAsync, exec } = Utils;
import { searchItem } from './searchitem.js';
import { execAndClose, couldBeMath, launchCustomCommand } from './miscfunctions.js';
import GeminiService from '../../services/gemini.js';
export const DirectoryButton = ({ parentPath, name, type, icon }) => {
const actionText = Widget.Revealer({
@@ -160,4 +161,16 @@ export const SearchButton = ({ text = '' }) => searchItem({
App.closeWindow('overview');
execAsync(['bash', '-c', `xdg-open '${userOptions.search.engineBaseUrl}${text} ${['', ...userOptions.search.excludedSites].join(' -site:')}' &`]).catch(print);
},
});
});
export const AiButton = ({ text }) => searchItem({
materialIconName: 'chat_paste_go',
name: 'Ask Gemini',
actionName: 'Ask',
content: `${text}`,
onActivate: () => {
GeminiService.send(text);
App.closeWindow('overview');
App.openWindow('sideleft');
},
});