Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion public/locales/en/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@
"signin-tips": "<0> Please <1>sign in</1> to deploy an Agent! 🤖 </0> ",
"generating-response": "🧠 Generating response...",
"searching-web-for": "🌐 Searching the web for {{arg}} ...",
"pause-mode": "Pause Mode"
"pause-mode": "Pause Mode",
"cody-chat": "Cody Chat",
"deep-seek-coder-v3": "Deep Seek Coder V3"
}
4 changes: 3 additions & 1 deletion public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,7 @@
"placeholder-agent-goal": "Make the world a better place.",
"paused": "Paused",
"add-task": "Add Task: ",
"custom-task": "Custom Task"
"custom-task": "Custom Task",
"cody-chat": "Cody Chat",
"deep-seek-coder-v3": "Deep Seek Coder V3"
}
4 changes: 3 additions & 1 deletion public/locales/en/help.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
"long-term-memory": "Long term memory",
"web-browsing": "Web browsing",
"interaction-with-websites-and-people": "Interaction with websites and people",
"follow-our-footsteps": "Please follow in our footsteps:"
"follow-our-footsteps": "Please follow in our footsteps:",
"cody-chat": "Cody Chat",
"deep-seek-coder-v3": "Deep Seek Coder V3"
}
6 changes: 4 additions & 2 deletions public/locales/en/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
"temp-tips": "Higher values will make the output more random, while lower values make the output more focused and deterministic.",
"loop": "Loop #:",
"loop-tips": "Controls the maximum number of loops that the agent will run (higher value will make more API calls).",
"api-key-notice": "<0>NOTE: To get a key, sign up for an OpenAI account and visit the following <1>link.</1>,This key is only used in the current browser session</0>",
"api-key-notice": "<0>NOTE: To get a key, sign up for an OpenAI account and visit the following <1>link</1>,This key is only used in the current browser session</0>",
"tokens-tips": "Controls the maximum number of tokens used in each API call (higher value will make responses more detailed but cost more).",
"tokens": "Tokens: ",
"guest-key": "Guest Key: ",
"endPoint": "Endpoint: ",
"mode": "Mode: ",
"mode-tips": "Automatic Mode (Default): Agent automatically executes every task. \n\nPause Mode: Agent pauses after every set of task(s)"
"mode-tips": "Automatic Mode (Default): Agent automatically executes every task. \n\nPause Mode: Agent pauses after every set of task(s)",
"cody-chat": "Cody Chat",
"deep-seek-coder-v3": "Deep Seek Coder V3"
}
4 changes: 3 additions & 1 deletion public/locales/zh/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@
"signin-tips": "<0> 请 <1>登录</1> 以部署代理! 🤖 </0> ",
"generating-response": "🧠 生成回复中...",
"searching-web-for": "🌐 正在搜索 {{arg}} ...",
"pause-mode": "暂停模式"
"pause-mode": "暂停模式",
"cody-chat": "Cody Chat",
"deep-seek-coder-v3": "Deep Seek Coder V3"
}
4 changes: 3 additions & 1 deletion public/locales/zh/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,7 @@
"placeholder-agent-goal": "让世界变得更美好。",
"paused": "已暂停",
"add-task": "新增任务:",
"custom-task": "自定义任务"
"custom-task": "自定义任务",
"cody-chat": "Cody Chat",
"deep-seek-coder-v3": "Deep Seek Coder V3"
}
4 changes: 3 additions & 1 deletion public/locales/zh/help.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
"long-term-memory": "长期记忆",
"web-browsing": "网络浏览",
"interaction-with-websites-and-people": "与网站和人的互动",
"follow-our-footsteps": "请跟随我们的脚步:"
"follow-our-footsteps": "请跟随我们的脚步:",
"cody-chat": "Cody Chat",
"deep-seek-coder-v3": "Deep Seek Coder V3"
}
4 changes: 3 additions & 1 deletion public/locales/zh/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@
"guest-key": "访问码:",
"endPoint": "代理:",
"mode": "模式:",
"mode-tips": "自动模式 (默认): 代理程序自动执行每个任务。\n\n暂停模式: 代理程序在每组任务后暂停"
"mode-tips": "自动模式 (默认): 代理程序自动执行每个任务。\n\n暂停模式: 代理程序在每组任务后暂停",
"cody-chat": "Cody Chat",
"deep-seek-coder-v3": "Deep Seek Coder V3"
}
22 changes: 22 additions & 0 deletions src/components/SettingsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
FaCoins,
FaCode,
FaServer,
FaComments,
FaSearch,
} from "react-icons/fa";
import Dialog from "./Dialog";
import Input from "./Input";
Expand Down Expand Up @@ -166,6 +168,26 @@ export const SettingsDialog: React.FC<{
step: 100,
}}
/>
<Input
left={
<>
<FaComments />
<span className="ml-2">{t("cody-chat")}</span>
</>
}
value={settings.codyChat}
onChange={(e) => updateSettings("codyChat", e.target.value)}
/>
<Input
left={
<>
<FaSearch />
<span className="ml-2">{t("deep-seek-coder-v3")}</span>
</>
}
value={settings.deepSeekCoderV3}
onChange={(e) => updateSettings("deepSeekCoderV3", e.target.value)}
/>
</div>
);

Expand Down
3 changes: 3 additions & 0 deletions src/components/SignInDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export const SignInDialog = ({ show, close }: SignInDialogProps) => {
</a>
to deploy an Agent! 🤖
</p>
<p>
You can also use Cody chat and deep seek coder v3 after signing in.
</p>
</Trans>
</Dialog>
);
Expand Down
3 changes: 3 additions & 0 deletions src/components/SorryDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ export const SorryDialog = ({ show, close }: SorryDialogProps) => {
More Detials
</a>
</p>
<p>
You can also use Cody chat and deep seek coder v3 after signing in.
</p>
</Trans>
</Dialog>
);
Expand Down
2 changes: 2 additions & 0 deletions src/hooks/useSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export const DEFAULT_SETTINGS: ModelSettings = {
customMaxTokens: DEFAULT_MAX_TOKENS,
customEndPoint: "",
customGuestKey: "",
codyChat: "",
deepSeekCoderV3: "",
};

const loadSettings = (): ModelSettings => {
Expand Down
5 changes: 3 additions & 2 deletions src/pages/api/agent/analyze.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ export const config = {

const handler = async (request: NextRequest) => {
try {
const { modelSettings, goal, task } = (await request.json()) as RequestBody;
const { modelSettings, goal, task, customLanguage } = (await request.json()) as RequestBody;
if (task === undefined) {
return;
}

const response = await AgentService.analyzeTaskAgent(
modelSettings,
goal,
task
task,
customLanguage
);
return NextResponse.json({
response: response,
Expand Down
34 changes: 25 additions & 9 deletions src/pages/api/agent/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,37 @@ const handler = async (request: NextRequest) => {
result,
completedTasks,
customLanguage,
agentType,
} = (await request.json()) as RequestBody;

if (tasks === undefined || lastTask === undefined || result === undefined) {
return;
}

const newTasks = await AgentService.createTasksAgent(
modelSettings,
goal,
tasks,
lastTask,
result,
completedTasks,
customLanguage
);
let newTasks;
if (agentType === "codyChat") {
newTasks = await AgentService.codyChatAgent(
modelSettings,
goal,
customLanguage
);
} else if (agentType === "deepSeekCoderV3") {
newTasks = await AgentService.deepSeekCoderV3Agent(
modelSettings,
goal,
customLanguage
);
} else {
newTasks = await AgentService.createTasksAgent(
modelSettings,
goal,
tasks,
lastTask,
result,
completedTasks,
customLanguage
);
}

return NextResponse.json({ newTasks });
} catch (e) {}
Expand Down
32 changes: 24 additions & 8 deletions src/pages/api/agent/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,35 @@ export const config = {

const handler = async (request: NextRequest) => {
try {
const { modelSettings, goal, task, analysis, customLanguage } =
const { modelSettings, goal, task, analysis, customLanguage, agentType } =
(await request.json()) as RequestBody;
if (task === undefined) {
return;
}

const response = await AgentService.executeTaskAgent(
modelSettings,
goal,
task,
analysis || DefaultAnalysis,
customLanguage
);
let response;
if (agentType === "codyChat") {
response = await AgentService.codyChatAgent(
modelSettings,
goal,
customLanguage
);
} else if (agentType === "deepSeekCoderV3") {
response = await AgentService.deepSeekCoderV3Agent(
modelSettings,
goal,
customLanguage
);
} else {
response = await AgentService.executeTaskAgent(
modelSettings,
goal,
task,
analysis || DefaultAnalysis,
customLanguage
);
}

return NextResponse.json({
response: response,
});
Expand Down
29 changes: 23 additions & 6 deletions src/pages/api/agent/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,30 @@ export const config = {

const handler = async (request: NextRequest) => {
try {
const { modelSettings, goal, customLanguage } =
const { modelSettings, goal, customLanguage, agentType } =
(await request.json()) as RequestBody;
const newTasks = await AgentService.startGoalAgent(
modelSettings,
goal,
customLanguage
);

let newTasks;
if (agentType === "codyChat") {
newTasks = await AgentService.codyChatAgent(
modelSettings,
goal,
customLanguage
);
} else if (agentType === "deepSeekCoderV3") {
newTasks = await AgentService.deepSeekCoderV3Agent(
modelSettings,
goal,
customLanguage
);
} else {
newTasks = await AgentService.startGoalAgent(
modelSettings,
goal,
customLanguage
);
}

return NextResponse.json({ newTasks });
} catch (e) {}

Expand Down
52 changes: 52 additions & 0 deletions src/services/agent-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,38 @@ async function createTasksAgent(
return extractTasks(completion.text as string, completedTasks || []);
}

async function codyChatAgent(
modelSettings: ModelSettings,
goal: string,
customLanguage: string
) {
const completion = await new LLMChain({
llm: createModel(modelSettings),
prompt: startGoalPrompt,
}).call({
goal,
customLanguage,
});
console.log("Cody Chat Goal", goal, "Completion:" + (completion.text as string));
return extractTasks(completion.text as string, []);
}

async function deepSeekCoderV3Agent(
modelSettings: ModelSettings,
goal: string,
customLanguage: string
) {
const completion = await new LLMChain({
llm: createModel(modelSettings),
prompt: startGoalPrompt,
}).call({
goal,
customLanguage,
});
console.log("Deep Seek Coder V3 Goal", goal, "Completion:" + (completion.text as string));
return extractTasks(completion.text as string, []);
}

interface AgentService {
startGoalAgent: (
modelSettings: ModelSettings,
Expand Down Expand Up @@ -146,13 +178,25 @@ interface AgentService {
completedTasks: string[] | undefined,
customLanguage: string,
) => Promise<string[]>;
codyChatAgent: (
modelSettings: ModelSettings,
goal: string,
customLanguage: string
) => Promise<string[]>;
deepSeekCoderV3Agent: (
modelSettings: ModelSettings,
goal: string,
customLanguage: string
) => Promise<string[]>;
}

const OpenAIAgentService: AgentService = {
startGoalAgent: startGoalAgent,
analyzeTaskAgent: analyzeTaskAgent,
executeTaskAgent: executeTaskAgent,
createTasksAgent: createTasksAgent,
codyChatAgent: codyChatAgent,
deepSeekCoderV3Agent: deepSeekCoderV3Agent,
};

const MockAgentService: AgentService = {
Expand Down Expand Up @@ -194,6 +238,14 @@ const MockAgentService: AgentService = {
) => {
return await new Promise((resolve) => resolve("Result: " + task));
},

codyChatAgent: async (modelSettings, goal, customLanguage) => {
return await new Promise((resolve) => resolve(["Cody Chat Task 1"]));
},

deepSeekCoderV3Agent: async (modelSettings, goal, customLanguage) => {
return await new Promise((resolve) => resolve(["Deep Seek Coder V3 Task 1"]));
},
};

export default env.NEXT_PUBLIC_FF_MOCK_MODE_ENABLED
Expand Down
2 changes: 2 additions & 0 deletions src/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export type ModelSettings = {
customEndPoint?: string;
customMaxTokens?: number;
customGuestKey?: string;
codyChat?: string;
deepSeekCoderV3?: string;
};

export type GuestSettings = {
Expand Down
Loading