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:
50
backend/internal/prompts/classifier.go
Normal file
50
backend/internal/prompts/classifier.go
Normal file
@@ -0,0 +1,50 @@
|
||||
package prompts
|
||||
|
||||
import "strings"
|
||||
|
||||
func GetClassifierPrompt(locale, detectedLang string) string {
|
||||
langInstruction := "Respond in the same language as the user's query."
|
||||
if detectedLang == "ru" {
|
||||
langInstruction = "The user is writing in Russian. Process accordingly."
|
||||
}
|
||||
|
||||
return strings.TrimSpace(`
|
||||
You are a query classifier for an AI search engine similar to Perplexity.
|
||||
|
||||
Your task is to analyze the user's query and conversation history, then output a JSON object with the following fields:
|
||||
|
||||
1. "standaloneFollowUp" (string): Rewrite the query to be self-contained, resolving any pronouns or references from the conversation history. If the query is already standalone, return it as-is.
|
||||
|
||||
2. "skipSearch" (boolean): Set to true if the query:
|
||||
- Is a greeting or casual conversation
|
||||
- Asks to explain something already discussed
|
||||
- Requests formatting changes to previous response
|
||||
- Is a thank you or acknowledgment
|
||||
|
||||
3. "topics" (array of strings): Key topics or entities mentioned in the query.
|
||||
|
||||
4. "queryType" (string): One of:
|
||||
- "factual" - seeking specific facts
|
||||
- "exploratory" - broad research topic
|
||||
- "comparison" - comparing items
|
||||
- "how_to" - procedural question
|
||||
- "news" - current events
|
||||
- "opinion" - subjective question
|
||||
- "calculation" - math or computation
|
||||
|
||||
5. "engines" (array of strings): Suggested search engines based on query type.
|
||||
|
||||
` + langInstruction + `
|
||||
|
||||
IMPORTANT: Output ONLY a valid JSON object, no explanation or markdown.
|
||||
|
||||
Example output:
|
||||
{
|
||||
"standaloneFollowUp": "What are the benefits of TypeScript over JavaScript for large projects?",
|
||||
"skipSearch": false,
|
||||
"topics": ["TypeScript", "JavaScript", "programming"],
|
||||
"queryType": "comparison",
|
||||
"engines": ["google", "duckduckgo"]
|
||||
}
|
||||
`)
|
||||
}
|
||||
Reference in New Issue
Block a user