Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

Bump app to v2.0.163

Louis Beaumontea5838fa4afd
diff --git a/screenpipe-app-tauri/components/global-chat.tsx b/screenpipe-app-tauri/components/global-chat.tsx
index 60ad68c3b..928c35c6c 100644
--- a/screenpipe-app-tauri/components/global-chat.tsx
+++ b/screenpipe-app-tauri/components/global-chat.tsx
@@ -10,7 +10,7 @@ import { Button } from "@/components/ui/button";
import { CustomDialogContent } from "@/components/rewind/custom-dialog-content";
import { useSettings, ChatMessage, ChatConversation } from "@/lib/hooks/use-settings";
import { cn } from "@/lib/utils";
-import { Loader2, Send, Square, User, X, Settings, ExternalLink, Video, Plus, Zap, History, Search, Trash2, ChevronLeft } from "lucide-react";
+import { Loader2, Send, Square, User, X, Settings, ExternalLink, Video, Plus, Zap, History, Search, Trash2, ChevronLeft, Copy, Check } from "lucide-react";
import { toast } from "@/components/ui/use-toast";
import { parseInt } from "lodash";
import { motion, AnimatePresence } from "framer-motion";
@@ -534,6 +534,7 @@ export function GlobalChat() {
const [messages, setMessages] = useState<Message[]>([]);
const [isLoading, setIsLoading] = useState(false);
const [isStreaming, setIsStreaming] = useState(false);
+ const [copiedMessageId, setCopiedMessageId] = useState<string | null>(null);
const [activePreset, setActivePreset] = useState<AIPreset | undefined>();
const [showMentionDropdown, setShowMentionDropdown] = useState(false);
const [mentionFilter, setMentionFilter] = useState("");
@@ -2147,7 +2148,7 @@ export function GlobalChat() {
</div>
<div
className={cn(
- "relative flex-1 rounded-xl px-4 py-3 text-sm border overflow-hidden min-w-0",
+ "group/message relative flex-1 rounded-xl px-4 py-3 text-sm border overflow-hidden min-w-0",
message.role === "user"
? "bg-foreground text-background border-foreground"
: "bg-muted/30 border-border/50"
diff --git a/screenpipe-js/ai-proxy/src/providers/gemini.ts b/screenpipe-js/ai-proxy/src/providers/gemini.ts
index 771c6c752..e1a1a28b4 100644
--- a/screenpipe-js/ai-proxy/src/providers/gemini.ts
+++ b/screenpipe-js/ai-proxy/src/providers/gemini.ts
@@ -50,6 +50,45 @@ export class GeminiProvider implements AIProvider {
);
}
+ /**
+ * Detect if user is explicitly asking for web search
+ * Returns the search query if detected, null otherwise
+ */
+ private detectWebSearchIntent(messages: Message[]): string | null {
+ // Get the last user message
+ const lastUserMsg = [...messages].reverse().find(m => m.role === 'user');
+ if (!lastUserMsg) return null;
+
+ const content = typeof lastUserMsg.content === 'string'
+ ? lastUserMsg.content.toLowerCase()
+ : '';
+
+ // Patterns that indicate explicit web search request
+ const webSearchPatterns = [
+ // "search X on internet/web" or "search X on the internet"
+ /search\s+(.+?)\s+on\s+(?:the\s+)?(?:internet|web|online)/i,
+ // "search internet/web for X" or "search the internet for X"
+ /search\s+(?:the\s+)?(?:internet|web|online|google)\s+(?:for\s+)?(.+)/i,
+ // "google X", "look up X", "find online X"
+ /(?:google|look\s*up|find\s+online|search\s+online)\s+(.+)/i,
+ // "what's the latest news on X"
+ /(?:what(?:'s| is) the latest|current|recent)\s+(?:news|info|information)\s+(?:on|about)\s+(.+)/i,
+ // "search internet X"
+ /search\s+(?:internet|web)\s+(.+)/i,
+ ];
+
+ for (const pattern of webSearchPatterns) {
+ const match = content.match(pattern);
+ if (match && match[1]) {
+ const query = match[1].trim().replace(/[?.!]+$/, '');
+ console.log('[Gemini Vertex] Web search intent detected:', query);
+ return query;
+ }
+ }
+
+ return null;
+ }
+
/**
* Generate a JWT for service account authentication
*/
@@ -153,11 +192,14 @@ export class GeminiProvider implements AIProvider {
private mapModelToVertex(model: string): string {
// Map common model names to Vertex AI format
const modelMap: Record<string, string> = {
+ 'gemini-flash': 'gemini-2.0-flash',
'gemini-3-flash': 'gemini-2.0-flash',
+ 'gemini-pro': 'gemini-2.0-pro-exp-02-05',
'gemini-3-pro': 'gemini-2.0-pro-exp-02-05',
'gemini-2.5-flash': 'gemini-2.0-flash',
'gemini-2.5-pro': 'gemini-2.0-pro-exp-02-05',
};
+ console.log('[Gemini Vertex] Model mapping:', model, '->', modelMap[model] || model);
return modelMap[model] || model;
}
@@ -246,9 +288,16 @@ export class GeminiProvider implements AIProvider {
async createStreamingCompletion(body: RequestBody): Promise<ReadableStream> {
const accessToken = await this.getAccessToken();
- const url = this.getEndpointUrl(body.model, true) + '?alt=sse';
const hasWebSearch = this.hasWebSearchTool(body.tools);
+ // Check for explicit web search intent - bypass model and search directly
+ const webSearchQuery = this.detectWebSearchIntent(body.messages);
+ if (webSearchQuery && hasWebSearch) {
+ console.log('[Gemini Vertex] Direct web search for:', webSearchQuery);
+ return this.createDirectWebSearchStream(body, webSearchQuery);
+ }
+
+ const url = this.getEndpointUrl(body.model, true) + '?alt=sse';
const requestBody = this.buildRequestBody(body, hasWebSearch);
console.log('[Gemini Vertex] Streaming request to:', url);
@@ -566,6 +615,71 @@ export class GeminiProvider implements AIProvider {
return { content, sources };
}
+ /**
+ * Create a streaming response that directly performs web search
+ * Used when we detect explicit web search intent from the user
+ */
+ private async createDirectWebSearchStream(body: RequestBody, query: string): Promise<ReadableStream> {
+ const self = this;
+
+ return new ReadableStream({
+ async start(controller) {
+ try {
+ // Stream a searching indicator
+ controller.enqueue(
+ new TextEncoder().encode(
+ `data: ${JSON.stringify({
+ choices: [{ delta: { content: `*Searching the web for "${query}"...*\n\n` } }],
+ })}\n\n`
+ )
+ );
+
+ // Execute web search
+ const searchResult = await self.executeWebSearch(query);
+
+ // Stream the result
+ controller.enqueue(
+ new TextEncoder().encode(
+ `data: ${JSON.stringify({
+ choices: [{ delta: { content: searchResult.content } }],
+ })}\n\n`
+ )
+ );
+
+ // Send finish reason
+ controller.enqueue(
+ new TextEncoder().encode(
+ `data: ${JSON.stringify({
+ choices: [{ delta: {}, finish_reason: 'stop' }],
+ })}\n\n`
+ )
+ );
+
+ controller.enqueue(new TextEncoder().encode('data: [DONE]\n\n'));
+ controller.close();
+ } catch (error) {
+ console.error('[Gemini Vertex] Direct web search failed:', error);
+ controller.enqueue(
+ new TextEncoder().encode(
+ `data: ${JSON.stringify({
+ choices: [{ delta: { content: 'Web search failed. Please try again.' } }],
+ })}\n\n`
+ )
+ );
+ controller.enqueue(
+ new TextEncoder().encode(
+ `data: ${JSON.stringify({
+ choices: [{ delta: {}, finish_reason: 'stop' }],
+ })}\n\n`
+ )
+ );
+ controller.enqueue(new TextEncoder().encode('data: [DONE]\n\n'));
+ controller.close();
+ }
+ },
+ });
+ }
+
/**
* Convert OpenAI JSON Schema parameters to Gemini schema format
*/