Skip to main content
Glama

Open Search MCP

by flyanima
MIT License
2
  • Apple
  • Linux
deepseek-ai-engine.ts2.44 kB
/** * DeepSeek AI引擎 * 提供成本效益极高的AI推理和分析能力 */ interface DeepSeekConfig { apiKey: string; baseUrl: string; defaultModel: string; maxTokens: number; temperature: number; } interface DeepSeekResponse { success: boolean; content?: string; usage?: { prompt_tokens: number; completion_tokens: number; total_tokens: number; }; cost?: number; responseTime?: number; error?: string; } interface SearchOptimization { optimizedKeywords: string[]; recommendedPlatforms: string[]; searchStrategy: string; expectedResults: string[]; qualityFilters: string[]; } interface ContentAnalysis { summary: string; keyPoints: string[]; credibilityScore: number; relevanceScore: number; tags: string[]; category: string; sentiment: 'positive' | 'neutral' | 'negative'; } export class DeepSeekAIEngine { private config: DeepSeekConfig; private requestCount: number = 0; private totalCost: number = 0; constructor() { this.config = { apiKey: process.env.DEEPSEEK_API_KEY || '', baseUrl: process.env.DEEPSEEK_BASE_URL || 'https://api.deepseek.com/v1', defaultModel: 'deepseek-reasoner', maxTokens: 2000, temperature: 0.3 }; if (!this.config.apiKey || this.config.apiKey === '') {} else {} } /** * 检查配置状态 */ isConfigured(): boolean { return !!this.config.apiKey; } /** * 获取使用统计 */ getUsageStats() { return { requestCount: this.requestCount, totalCost: this.totalCost, averageCostPerRequest: this.requestCount > 0 ? this.totalCost / this.requestCount : 0, isConfigured: !!this.config.apiKey }; } /** * 重置统计 */ resetStats() { this.requestCount = 0; this.totalCost = 0; } /** * 生成摘要 */ async generateSummary(text: string, maxLength: number = 200): Promise<string | null> { if (!this.isConfigured()) {return text.substring(0, maxLength); } try { // 简单的文本清理和摘要 const cleanedText = text .replace(/\s+/g, ' ') .replace(/[^\w\s.,!?;:()\-]/g, '') .trim(); if (cleanedText.length <= maxLength) { return cleanedText; } // 如果文本太长,截取前面部分 return cleanedText.substring(0, maxLength - 3) + '...'; } catch (error) {return text.substring(0, maxLength); } } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/flyanima/open-search-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server