Skip to content

Commit

Permalink
feat: modify test
Browse files Browse the repository at this point in the history
  • Loading branch information
veasion committed Dec 30, 2024
1 parent 72e287b commit 76bfc8b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 28 deletions.
8 changes: 2 additions & 6 deletions src/background/test_llm_computer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,8 @@ export async function testWebSearchWithComputer() {
throw Error("Please configure apiKey");
}
let llmProvider = config.llm == "openai"
? new OpenaiProvider(config.apiKey, config.modelName, {
baseURL: config.baseURL,
})
: new ClaudeProvider(config.apiKey, config.modelName, {
baseURL: config.baseURL,
});
? new OpenaiProvider(config.apiKey, config.modelName, config.options)
: new ClaudeProvider(config.apiKey, config.modelName, config.options);
let context = {
llmProvider,
variables: new Map<string, unknown>(),
Expand Down
8 changes: 2 additions & 6 deletions src/background/test_llm_search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,8 @@ export async function testWebSearchWithLLM() {
throw Error("Please configure apiKey");
}
let llmProvider = config.llm == "openai"
? new OpenaiProvider(config.apiKey, config.modelName, {
baseURL: config.baseURL,
})
: new ClaudeProvider(config.apiKey, config.modelName, {
baseURL: config.baseURL,
});
? new OpenaiProvider(config.apiKey, config.modelName, config.options)
: new ClaudeProvider(config.apiKey, config.modelName, config.options);
let context = {
llmProvider,
variables: new Map<string, unknown>(),
Expand Down
8 changes: 2 additions & 6 deletions src/background/test_llm_workflow.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import { Eko, WorkflowParser } from "ekoai";
import { tools, getLLMConfig } from "ekoai/extension";
import { EkoConfig } from "ekoai/types";

export async function testWebSearchWithWorkflow() {
let config = await getLLMConfig();
if (!config && !config.apiKey) {
throw Error("Please configure apiKey");
}

let eko = new Eko({
llm: config.llm as any,
apiKey: config.apiKey,
modelName: config.modelName,
options: { baseURL: config.baseURL },
});
let eko = new Eko(config as EkoConfig);

eko.registerTool(new tools.WebSearch());
eko.registerTool(new tools.ExportFile());
Expand Down
24 changes: 14 additions & 10 deletions src/options/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ const OptionsPage = () => {

const [config, setConfig] = useState({
llm: "claude",
baseURL: "https://api.anthropic.com",
modelName: "claude-3-5-sonnet-20241022",
apiKey: "",
modelName: "claude-3-5-sonnet-20241022",
options: {
baseURL: "https://api.anthropic.com",
},
});

useEffect(() => {
Expand Down Expand Up @@ -40,7 +42,7 @@ const OptionsPage = () => {
}
);
})
.catch((errorInfo) => {
.catch(() => {
message.error("Please check the form field");
});
};
Expand All @@ -65,12 +67,14 @@ const OptionsPage = () => {
const handleLLMChange = (value: string) => {
const newConfig = {
llm: value,
baseURL:
value === "openai"
? "https://api.openai.com/v1"
: "https://api.anthropic.com",
modelName: modelOptions[value][0].value,
apiKey: "",
modelName: modelOptions[value][0].value,
options: {
baseURL:
value === "openai"
? "https://api.openai.com/v1"
: "https://api.anthropic.com",
},
};
setConfig(newConfig);
form.setFieldsValue(newConfig);
Expand Down Expand Up @@ -99,7 +103,7 @@ const OptionsPage = () => {
</Select>
</Form.Item>
<Form.Item
name="baseURL"
name={["options", "baseURL"]}
label="Base URL"
rules={[
{
Expand All @@ -108,7 +112,7 @@ const OptionsPage = () => {
},
]}
>
<Input placeholder="Please enter the base URL" allowClear />
<Input placeholder="Please enter the base URL" />
</Form.Item>

<Form.Item
Expand Down

0 comments on commit 76bfc8b

Please sign in to comment.