Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

chore: update command k search config (#2423)

gbirman7457137f3d80
diff --git a/js/app/packages/app/component/command/useCommandItems.ts b/js/app/packages/app/component/command/useCommandItems.ts
index 6bd68b9ea2..460ba6d3aa 100644
--- a/js/app/packages/app/component/command/useCommandItems.ts
+++ b/js/app/packages/app/component/command/useCommandItems.ts
@@ -7,7 +7,7 @@ import {
exclude,
} from '@core/context/quickAccess';
import type { HotkeyCommand } from '@core/hotkey/types';
-import { createFreshSearch } from '@core/util/freshSort';
+import { createFreshSearch, type FreshSortConfig } from '@core/util/freshSort';
import { createMemo } from 'solid-js';
import type { CategoryFilter } from './types';
import {
@@ -48,12 +48,12 @@ function isUserItem(item: CommandMenuItem): item is UserItem {
return item.kind === 'user';
}
-function createSearchConfig(hasQuery: boolean) {
+function createSearchConfig(hasQuery: boolean): FreshSortConfig {
return {
useViewedAt: true,
dmBoost: hasQuery ? 1.8 : 1.0,
fuzzyWeight: hasQuery ? 0.7 : 0.0,
- timeWeight: hasQuery ? 0.5 : 0.9,
+ timeWeight: hasQuery ? 0.7 : 0.9,
minFuzzyThreshold: hasQuery ? 0.1 : 0,
commaSeparatedChannelMatch: true,
};
diff --git a/js/app/packages/core/util/freshSort.ts b/js/app/packages/core/util/freshSort.ts
index 9a18354b8c..7e013e2bed 100644
--- a/js/app/packages/core/util/freshSort.ts
+++ b/js/app/packages/core/util/freshSort.ts
@@ -30,7 +30,7 @@ type BooleanFn<T> = (item: T) => boolean;
type EmailFn<T> = (item: T) => string | undefined;
-export interface FreshSortConfig<T> {
+export interface FreshSortConfig<T = unknown> {
/** Weight for fuzzy match (0-1). Higher values prioritize search relevance. Default: 0.7 */
fuzzyWeight?: number;
/** Weight for time recency (0-1). Higher values prioritize recent items. Default: 0.3 */
@@ -53,9 +53,9 @@ export interface FreshSortConfig<T> {
commaSeparatedChannelMatch?: boolean;
/** Function to calculate per-item boost. Returns a boost multiplier (e.g., 0.2 for +20% boost). Default: undefined */
boostFn?: BoostFn<T>;
- /** How much to penalize matches with gaps between characters (0-1). Higher values penalize spread-out matches more. Default: 1.0 */
+ /** How much to penalize matches with gaps between characters (0-1). Higher values penalize spread-out matches more. Default: 0 */
gapPenaltyWeight?: number;
- /** How much to penalize matches that start later in the string. Higher values penalize later starts more. Default: 0.05 */
+ /** How much to penalize matches that start later in the string. Higher values penalize later starts more. Default: 0 */
startBonusDecay?: number;
}
@@ -87,8 +87,8 @@ const DEFAULT_CONFIG = {
dmBoost: 1.0,
commaSeparatedChannelMatch: false,
boostFn: undefined,
- gapPenaltyWeight: 1.0,
- startBonusDecay: 0.05,
+ gapPenaltyWeight: 0,
+ startBonusDecay: 0,
} as const;
function extractTimestamp(