feat: Go backend, enhanced search, new widgets, Docker deploy
Major changes: - Add Go backend (backend/) with microservices architecture - Enhanced master-agents-svc: reranker, content-classifier, stealth-crawler, proxy-manager, media-search, fastClassifier, language detection - New web-svc widgets: KnowledgeCard, ProductCard, ProfileCard, VideoCard, UnifiedCard, CardGallery, InlineImageGallery, SourcesPanel, RelatedQuestions - Improved discover-svc with discover-db integration - Docker deployment improvements (Caddyfile, vendor.sh, BUILD.md) - Library-svc: project_id schema migration - Remove deprecated finance-svc and travel-svc - Localization improvements across services Made-with: Cursor
This commit is contained in:
@@ -4,22 +4,22 @@ import type { Chunk, SearchResultsResearchBlock } from '../types.js';
|
||||
import { searchSearxng } from '../searxng.js';
|
||||
|
||||
const schema = z.object({
|
||||
queries: z.array(z.string()).describe('List of social search queries'),
|
||||
queries: z.array(z.string()).max(6).describe('List of social search queries'),
|
||||
});
|
||||
|
||||
const socialSearchAction: ResearchAction<typeof schema> = {
|
||||
name: 'social_search',
|
||||
schema,
|
||||
getToolDescription: () =>
|
||||
'Use this tool to perform social media searches for relevant posts, discussions, and trends. Provide up to 3 queries at a time.',
|
||||
'Use this tool to perform social media searches for posts, discussions, and trends. Provide up to 6 queries in the user\'s language.',
|
||||
getDescription: () =>
|
||||
'Use this tool to perform social media searches for posts, discussions, and trends. Provide concise search queries. You can provide up to 3 queries at a time.',
|
||||
'Use this tool to perform social media searches for posts, discussions, and trends. Up to 6 queries in the user\'s language.',
|
||||
enabled: (config) =>
|
||||
config.sources.includes('discussions') &&
|
||||
config.classification.classification.skipSearch === false &&
|
||||
config.classification.classification.discussionSearch === true,
|
||||
execute: async (input, additionalConfig) => {
|
||||
input.queries = input.queries.slice(0, 3);
|
||||
input.queries = input.queries.slice(0, 6);
|
||||
|
||||
const researchBlock = additionalConfig.session.getBlock(additionalConfig.researchBlockId);
|
||||
|
||||
@@ -39,7 +39,23 @@ const socialSearchAction: ResearchAction<typeof schema> = {
|
||||
const results: Chunk[] = [];
|
||||
|
||||
const search = async (q: string) => {
|
||||
const res = await searchSearxng(q, { engines: ['reddit'] });
|
||||
const [page1, page2] = await Promise.all([
|
||||
searchSearxng(q, {
|
||||
categories: ['social_media'],
|
||||
pageno: 1,
|
||||
}),
|
||||
searchSearxng(q, {
|
||||
categories: ['social_media'],
|
||||
pageno: 2,
|
||||
}),
|
||||
]);
|
||||
const seenUrls = new Set<string>();
|
||||
const allResults = [...(page1.results ?? []), ...(page2.results ?? [])].filter((r) => {
|
||||
if (!r.url || seenUrls.has(r.url)) return false;
|
||||
seenUrls.add(r.url);
|
||||
return true;
|
||||
});
|
||||
const res = { results: allResults };
|
||||
const resultChunks: Chunk[] = res.results.map((r) => ({
|
||||
content: r.content || r.title,
|
||||
metadata: { title: r.title, url: r.url },
|
||||
|
||||
Reference in New Issue
Block a user