Explorar o código

feat: support deepseek-r1 model

ramlinbird hai 5 meses
pai
achega
9a2886a808

+ 2 - 2
chrome-extension/src/background/agent/agents/base.ts

@@ -192,8 +192,8 @@ export abstract class BaseAgent<T extends z.ZodType, M = unknown> {
         // Find the JSON content between code blocks
         cleanedContent = cleanedContent.split('```')[1];
         // Remove language identifier if present (e.g., 'json\n')
-        if (cleanedContent.includes('\n')) {
-          cleanedContent = cleanedContent.split('\n', 2)[1];
+        if (cleanedContent.includes('json\n')) {
+          cleanedContent = cleanedContent.replace(/^json\s*/, '');
         }
       }
       // Parse the cleaned content

+ 2 - 2
chrome-extension/src/background/agent/prompts/planner.ts

@@ -35,11 +35,11 @@ RESPONSIBILITIES:
 RESPONSE FORMAT: Your must always respond with a valid JSON object with the following fields:
 {
     "observation": "Brief analysis of the current state and what has been done so far",
-    "done": "true or false, whether further steps are needed to complete the ultimate task",
+    "done": "true or false [boolean type], whether further steps are needed to complete the ultimate task",
     "challenges": "List any potential challenges or roadblocks",
     "next_steps": "List 2-3 high-level next steps to take, each step should start with a new line",
     "reasoning": "Explain your reasoning for the suggested next steps",
-    "web_task": "true or false, whether the ultimate task is related to browsing the web"
+    "web_task": "true or false [boolean type], whether the ultimate task is related to browsing the web"
 }
 
 NOTE:

+ 1 - 1
packages/storage/lib/settings/types.ts

@@ -12,7 +12,7 @@ export enum LLMProviderEnum {
 }
 
 export const llmProviderModelNames = {
-  [LLMProviderEnum.OpenAI]: ['gpt-4o', 'gpt-4o-mini', 'o1', 'o1-mini', 'o3-mini'],
+  [LLMProviderEnum.OpenAI]: ['gpt-4o', 'gpt-4o-mini', 'o1', 'o1-mini', 'o3-mini', 'deepseek-r1'],
   [LLMProviderEnum.Anthropic]: ['claude-3-7-sonnet-latest', 'claude-3-5-haiku-latest'],
   [LLMProviderEnum.Gemini]: [
     'gemini-2.0-flash',