mirror of
https://github.com/getcompanion-ai/alpha-hub.git
synced 2026-04-17 03:03:43 +00:00
Improve alphaXiv client outputs and exports
This commit is contained in:
parent
9a708a1ab9
commit
270eaa1dc5
11 changed files with 417 additions and 11 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import chalk from 'chalk';
|
||||
import { searchByEmbedding, searchByKeyword, disconnect } from '../lib/alphaxiv.js';
|
||||
import { searchByEmbedding, searchByKeyword, agenticSearch, disconnect } from '../lib/alphaxiv.js';
|
||||
import { output, error } from '../lib/output.js';
|
||||
|
||||
function formatResults(data) {
|
||||
|
|
@ -10,20 +10,29 @@ function formatResults(data) {
|
|||
export function registerSearchCommand(program) {
|
||||
program
|
||||
.command('search <query>')
|
||||
.description('Search papers via alphaXiv (semantic + keyword)')
|
||||
.option('-m, --mode <mode>', 'Search mode: semantic, keyword, both', 'semantic')
|
||||
.description('Search papers via alphaXiv (semantic, keyword, both, agentic, or all)')
|
||||
.option('-m, --mode <mode>', 'Search mode: semantic, keyword, both, agentic, all', 'semantic')
|
||||
.action(async (query, cmdOpts) => {
|
||||
const opts = { ...program.opts(), ...cmdOpts };
|
||||
try {
|
||||
let results;
|
||||
if (opts.mode === 'keyword') {
|
||||
results = await searchByKeyword(query);
|
||||
} else if (opts.mode === 'agentic') {
|
||||
results = await agenticSearch(query);
|
||||
} else if (opts.mode === 'both') {
|
||||
const [semantic, keyword] = await Promise.all([
|
||||
searchByEmbedding(query),
|
||||
searchByKeyword(query),
|
||||
]);
|
||||
results = { semantic, keyword };
|
||||
} else if (opts.mode === 'all') {
|
||||
const [semantic, keyword, agentic] = await Promise.all([
|
||||
searchByEmbedding(query),
|
||||
searchByKeyword(query),
|
||||
agenticSearch(query),
|
||||
]);
|
||||
results = { semantic, keyword, agentic };
|
||||
} else {
|
||||
results = await searchByEmbedding(query);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue