ags: sync

This commit is contained in:
end-4
2024-01-22 23:08:47 +07:00
parent 502abe7648
commit 63d471c3df
5 changed files with 95 additions and 43 deletions
+4 -10
View File
@@ -23,16 +23,10 @@ export const chatGPTTabIcon = Box({
});
const ChatGPTInfo = () => {
const openAiLogo = Icon({
const openAiLogo = Label({
hpack: 'center',
className: 'sidebar-chat-welcome-logo',
icon: `${App.configDir}/assets/openai-logomark.svg`,
setup: (self) => Utils.timeout(400, () => { // A long wait, but no one's going to open sidebar right on init anyway
const styleContext = self.get_style_context();
const width = styleContext.get_property('min-width', Gtk.StateFlags.NORMAL);
const height = styleContext.get_property('min-height', Gtk.StateFlags.NORMAL);
self.size = Math.max(width, height, 1) * 116 / 180; // Why such a specific proportion? See https://openai.com/brand#logos
})
label: 'forum',
})
return Box({
vertical: true,
@@ -43,7 +37,7 @@ const ChatGPTInfo = () => {
className: 'txt txt-title-small sidebar-chat-welcome-txt',
wrap: true,
justify: Gtk.Justification.CENTER,
label: 'ChatGPT',
label: 'Assistant',
}),
Box({
className: 'spacing-h-5',
@@ -153,7 +147,7 @@ export const OpenaiApiKeyInstructions = () => Box({
})]
});
export const chatGPTWelcome = Box({
const chatGPTWelcome = Box({
vexpand: true,
homogeneous: true,
child: Box({
+55 -2
View File
@@ -5,7 +5,7 @@ const { Box, Button, Label, Overlay, Revealer, Scrollable, Stack } = Widget;
const { execAsync, exec } = Utils;
import { MaterialIcon } from "../../../lib/materialicon.js";
import { MarginRevealer } from '../../../lib/advancedwidgets.js';
import { setupCursorHover } from "../../../lib/cursorhover.js";
import { setupCursorHover, setupCursorHoverInfo } from "../../../lib/cursorhover.js";
import WaifuService from '../../../services/waifus.js';
async function getImageViewerApp(preferredApp) {
@@ -220,10 +220,62 @@ const WaifuImage = (taglist) => {
return thisBlock;
}
const WaifuInfo = () => {
const waifuLogo = Label({
hpack: 'center',
className: 'sidebar-chat-welcome-logo',
label: 'photo_library',
})
return Box({
vertical: true,
vexpand: true,
className: 'spacing-v-15',
children: [
waifuLogo,
Label({
className: 'txt txt-title-small sidebar-chat-welcome-txt',
wrap: true,
justify: Gtk.Justification.CENTER,
label: 'Waifus',
}),
Box({
className: 'spacing-h-5',
hpack: 'center',
children: [
Label({
className: 'txt-smallie txt-subtext',
wrap: true,
justify: Gtk.Justification.CENTER,
label: 'Powered by waifu.im',
}),
Button({
className: 'txt-subtext txt-norm icon-material',
label: 'info',
tooltipText: 'A free Waifu API. An alternative to waifu.pics.',
setup: setupCursorHoverInfo,
}),
]
}),
]
});
}
const waifuWelcome = Box({
vexpand: true,
homogeneous: true,
child: Box({
className: 'spacing-v-15',
vpack: 'center',
vertical: true,
children: [
WaifuInfo(),
]
})
});
const waifuContent = Box({
className: 'spacing-v-15',
vertical: true,
vexpand: true,
attribute: {
'map': new Map(),
},
@@ -251,6 +303,7 @@ export const waifuView = Scrollable({
child: Box({
vertical: true,
children: [
waifuWelcome,
waifuContent,
]
}),
+2 -2
View File
@@ -11,12 +11,12 @@ import { waifuView, waifuCommands, sendMessage as waifuSendMessage, waifuTabIcon
const APIS = [
{
name: 'ChatGPT',
name: 'Assistant',
sendCommand: chatGPTSendMessage,
contentWidget: chatGPTView,
commandBar: chatGPTCommands,
tabIcon: chatGPTTabIcon,
placeholderText: 'Message ChatGPT',
placeholderText: 'Message assistant',
},
{
name: 'Waifus',