Skip to content

Commit

Permalink
refactor: change default onlyFeatured to false
Browse files Browse the repository at this point in the history
  • Loading branch information
snowyu committed Jun 21, 2024
1 parent 0f36ee8 commit 0a1d28e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/lib/brain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ export function listBrains(userConfig: any, flags: any) {
export function searchBrains(brainDir: string, flags: any) {
const brains = ToolFunc.get(BRAINS_FUNC_NAME) as LlmModelsFunc
const filter:any = flags.search ?? {}
let onlyFeatured = flags.onlyFeatured
const onlyFeatured = flags.onlyFeatured
if (!flags.all) {
if (flags.downloaded) {
filter.downloaded = {'=': true}
} else {
filter.$or = [{downloaded: {'!=': true}}, {downloaded: null}]
}
// filter.downloaded = flags.downloaded ? {'=': true} : {'!=': true}
if (!flags.downloaded && onlyFeatured === undefined) {
// the defaults for online is true
onlyFeatured = true
}
// if (!flags.downloaded && onlyFeatured === undefined) {
// // the defaults for online is true
// onlyFeatured = true
// }

if (onlyFeatured) {
filter.featured = true
Expand Down
3 changes: 2 additions & 1 deletion src/oclif/commands/brain/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Args, Flags } from '@oclif/core'

export default class AIBrainListCommand extends AICommand {
static summary = '📜 List downloaded or online brains, defaults to downloaded.'
static aliases = ['search']

// static description = ''

Expand All @@ -33,7 +34,7 @@ export default class AIBrainListCommand extends AICommand {
onlyFeatured: Flags.boolean({
char: 'f',
aliases: ['only-featured'],
description: 'only list featured brains, defaults to true for online',
description: 'only list featured brains',
allowNo: true,
}),
search: Flags.string({
Expand Down
23 changes: 23 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,27 @@ export default defineConfig({
// splitting: true,
// sourcemap: true,
clean: true,
minify: 'terser',
terserOptions: {
// compress: {
// drop_console: true,
// drop_debugger: true,
// },
// https://terser.org/docs/options/#mangle-options
"mangle": {
"properties": {
"regex": /^_[$]/,
// "undeclared": true, // Mangle those names when they are accessed as properties of known top level variables but their declarations are never found in input code.
},
"toplevel": true,
"reserved": [
// # expected names in web-extension content
"WeakSet", "Set",
// # expected names in 3rd-party extensions' contents
"requestIdleCallback",
// # content global names:
"browser",
],
}
},
})

0 comments on commit 0a1d28e

Please sign in to comment.