ags: user options: sidebar page order

This commit is contained in:
end-4
2024-05-27 10:13:42 +07:00
parent e46dc5e1a4
commit b778e65710
3 changed files with 22 additions and 13 deletions
@@ -79,6 +79,13 @@ let configOptions = {
'batchCount': 20,
'allowNsfw': false,
},
'pages': {
'order': ["apis", "tools"],
'apis': {
'order': ["gemini", "gpt", "waifu", "booru"],
}
},
},
'search': {
'engineBaseUrl': "https://www.google.com/search?q=",
+7 -6
View File
@@ -19,8 +19,8 @@ import { widgetContent } from './sideleft.js';
import { IconTabContainer } from '../.commonwidgets/tabcontainer.js';
const EXPAND_INPUT_THRESHOLD = 30;
const APIS = [
{
const APILIST = {
'gemini': {
name: 'Assistant (Gemini Pro)',
sendCommand: geminiSendMessage,
contentWidget: geminiView,
@@ -28,7 +28,7 @@ const APIS = [
tabIcon: geminiTabIcon,
placeholderText: 'Message Gemini...',
},
{
'gpt': {
name: 'Assistant (GPTs)',
sendCommand: chatGPTSendMessage,
contentWidget: chatGPTView,
@@ -36,7 +36,7 @@ const APIS = [
tabIcon: chatGPTTabIcon,
placeholderText: 'Message the model...',
},
{
'waifu': {
name: 'Waifus',
sendCommand: waifuSendMessage,
contentWidget: waifuView,
@@ -44,7 +44,7 @@ const APIS = [
tabIcon: waifuTabIcon,
placeholderText: 'Enter tags',
},
{
'booru': {
name: 'Booru',
sendCommand: booruSendMessage,
contentWidget: booruView,
@@ -52,7 +52,8 @@ const APIS = [
tabIcon: booruTabIcon,
placeholderText: 'Enter tags',
},
];
}
const APIS = userOptions.sidebar.pages.apis.order.map((apiName) => APILIST[apiName]);
let currentApiId = 0;
function apiSendMessage(textView) {
+8 -7
View File
@@ -12,20 +12,21 @@ import { chatEntry } from './apiwidgets.js';
import { TabContainer } from '../.commonwidgets/tabcontainer.js';
import { checkKeybind } from '../.widgetutils/keybind.js';
const contents = [
{
const SIDEBARTABS = {
'apis': {
name: 'apis',
content: apiWidgets,
materialIcon: 'api',
friendlyName: 'APIs',
},
{
'tools': {
name: 'tools',
content: toolBox,
materialIcon: 'home_repair_service',
friendlyName: 'Tools',
},
]
}
const CONTENTS = userOptions.sidebar.pages.order.map((tabName) => SIDEBARTABS[tabName])
const pinButton = Button({
attribute: {
@@ -61,9 +62,9 @@ const pinButton = Button({
})
export const widgetContent = TabContainer({
icons: contents.map((item) => item.materialIcon),
names: contents.map((item) => item.friendlyName),
children: contents.map((item) => item.content),
icons: CONTENTS.map((item) => item.materialIcon),
names: CONTENTS.map((item) => item.friendlyName),
children: CONTENTS.map((item) => item.content),
className: 'sidebar-left spacing-v-10',
setup: (self) => self.hook(App, (self, currentName, visible) => {
if (currentName === 'sideleft')