rename resultSize to count

This commit is contained in:
zerofata
2025-01-12 07:20:36 +13:00
committed by GitHub
parent fc5debc660
commit 89c984830b

View File

@@ -1615,12 +1615,12 @@ jQuery(async () => {
callback: async (args, query) => {
const clamp = (v) => Number.isNaN(v) ? null : Math.min(1, Math.max(0, v));
const threshold = clamp(Number(args?.threshold ?? settings.score_threshold));
const validateSize = (v) => Number.isNaN(v) || !Number.isInteger(v) || v < 1 ? null : v;
const resultSize = validateSize(Number(args?.resultSize)) ?? settings.chunk_count_db;
const validateCount = (v) => Number.isNaN(v) || !Number.isInteger(v) || v < 1 ? null : v;
const count = validateCount(Number(args?.count)) ?? settings.chunk_count_db;
const source = String(args?.source ?? '');
const attachments = source ? getDataBankAttachmentsForSource(source, false) : getDataBankAttachments(false);
const collectionIds = await ingestDataBankAttachments(String(source));
const queryResults = await queryMultipleCollections(collectionIds, String(query), resultSize, threshold);
const queryResults = await queryMultipleCollections(collectionIds, String(query), count, threshold);
// Get URLs
const urls = Object
@@ -1651,7 +1651,7 @@ jQuery(async () => {
helpString: 'Search the Data Bank for a specific query using vector similarity. Returns a list of file URLs with the most relevant content.',
namedArgumentList: [
new SlashCommandNamedArgument('threshold', 'Threshold for the similarity score in the [0, 1] range. Uses the global config value if not set.', ARGUMENT_TYPE.NUMBER, false, false, ''),
new SlashCommandNamedArgument('resultSize', 'Maximum number of query results to return.', ARGUMENT_TYPE.NUMBER, false, false, ''),
new SlashCommandNamedArgument('count', 'Maximum number of query results to return.', ARGUMENT_TYPE.NUMBER, false, false, ''),
new SlashCommandNamedArgument('source', 'Optional filter for the attachments by source.', ARGUMENT_TYPE.STRING, false, false, '', ['global', 'character', 'chat']),
SlashCommandNamedArgument.fromProps({
name: 'return',