add api key to config
This commit is contained in:
@@ -59,6 +59,7 @@ class PipelineCreateRequest(BaseModel):
|
|||||||
prompt_set_id: str
|
prompt_set_id: str
|
||||||
tool_keys: List[str] = Field(default_factory=list)
|
tool_keys: List[str] = Field(default_factory=list)
|
||||||
port: int
|
port: int
|
||||||
|
api_key: str
|
||||||
entry_point: str = Field(default="fastapi_server/server_dashscope.py")
|
entry_point: str = Field(default="fastapi_server/server_dashscope.py")
|
||||||
llm_name: str = Field(default="qwen-plus")
|
llm_name: str = Field(default="qwen-plus")
|
||||||
|
|
||||||
@@ -289,6 +290,7 @@ async def create_pipeline(body: PipelineCreateRequest):
|
|||||||
prompt_set=body.prompt_set_id,
|
prompt_set=body.prompt_set_id,
|
||||||
tool_keys=body.tool_keys,
|
tool_keys=body.tool_keys,
|
||||||
port=str(body.port),
|
port=str(body.port),
|
||||||
|
api_key=body.api_key,
|
||||||
entry_pnt=body.entry_point,
|
entry_pnt=body.entry_point,
|
||||||
llm_name=body.llm_name,
|
llm_name=body.llm_name,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -25,12 +25,14 @@ type EditableAgent = {
|
|||||||
toolKeys: string[];
|
toolKeys: string[];
|
||||||
prompts: Record<string, string>;
|
prompts: Record<string, string>;
|
||||||
port: number;
|
port: number;
|
||||||
|
apiKey: string;
|
||||||
llmName: string;
|
llmName: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
const DEFAULT_ENTRY_POINT = "fastapi_server/server_dashscope.py";
|
const DEFAULT_ENTRY_POINT = "fastapi_server/server_dashscope.py";
|
||||||
const DEFAULT_LLM_NAME = "qwen-plus";
|
const DEFAULT_LLM_NAME = "qwen-plus";
|
||||||
const DEFAULT_PORT = 8100;
|
const DEFAULT_PORT = 8100;
|
||||||
|
const DEFAULT_API_KEY = "";
|
||||||
const GRAPH_ARCH_IMAGE_MODULES = import.meta.glob(
|
const GRAPH_ARCH_IMAGE_MODULES = import.meta.glob(
|
||||||
"../assets/images/graph_arch/*.{png,jpg,jpeg,webp,gif}",
|
"../assets/images/graph_arch/*.{png,jpg,jpeg,webp,gif}",
|
||||||
{ eager: true, import: "default" }
|
{ eager: true, import: "default" }
|
||||||
@@ -91,6 +93,7 @@ function toEditable(
|
|||||||
toolKeys: config.tool_keys || [],
|
toolKeys: config.tool_keys || [],
|
||||||
prompts: config.prompt_dict || {},
|
prompts: config.prompt_dict || {},
|
||||||
port: DEFAULT_PORT,
|
port: DEFAULT_PORT,
|
||||||
|
apiKey: DEFAULT_API_KEY,
|
||||||
llmName: DEFAULT_LLM_NAME,
|
llmName: DEFAULT_LLM_NAME,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -195,6 +198,7 @@ export default function App() {
|
|||||||
const editable = toEditable(detail, false);
|
const editable = toEditable(detail, false);
|
||||||
editable.id = id;
|
editable.id = id;
|
||||||
editable.port = editor?.pipelineId === editable.pipelineId ? editor.port : DEFAULT_PORT;
|
editable.port = editor?.pipelineId === editable.pipelineId ? editor.port : DEFAULT_PORT;
|
||||||
|
editable.apiKey = editor?.pipelineId === editable.pipelineId ? editor.apiKey : DEFAULT_API_KEY;
|
||||||
editable.llmName = editor?.pipelineId === editable.pipelineId ? editor.llmName : DEFAULT_LLM_NAME;
|
editable.llmName = editor?.pipelineId === editable.pipelineId ? editor.llmName : DEFAULT_LLM_NAME;
|
||||||
setEditor(editable);
|
setEditor(editable);
|
||||||
setStatusMessage("");
|
setStatusMessage("");
|
||||||
@@ -334,6 +338,7 @@ export default function App() {
|
|||||||
const saved = toEditable(detail, false);
|
const saved = toEditable(detail, false);
|
||||||
saved.id = makeAgentKey(upsertResp.pipeline_id, upsertResp.prompt_set_id);
|
saved.id = makeAgentKey(upsertResp.pipeline_id, upsertResp.prompt_set_id);
|
||||||
saved.port = editor.port;
|
saved.port = editor.port;
|
||||||
|
saved.apiKey = editor.apiKey;
|
||||||
saved.llmName = editor.llmName;
|
saved.llmName = editor.llmName;
|
||||||
setEditor(saved);
|
setEditor(saved);
|
||||||
setSelectedId(saved.id);
|
setSelectedId(saved.id);
|
||||||
@@ -389,6 +394,10 @@ export default function App() {
|
|||||||
setStatusMessage("port must be a positive integer.");
|
setStatusMessage("port must be a positive integer.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!editor.apiKey.trim()) {
|
||||||
|
setStatusMessage("api_key is required before run.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setBusy(true);
|
setBusy(true);
|
||||||
setStatusMessage("Starting agent...");
|
setStatusMessage("Starting agent...");
|
||||||
@@ -399,6 +408,7 @@ export default function App() {
|
|||||||
prompt_set_id: editor.promptSetId,
|
prompt_set_id: editor.promptSetId,
|
||||||
tool_keys: editor.toolKeys,
|
tool_keys: editor.toolKeys,
|
||||||
port: editor.port,
|
port: editor.port,
|
||||||
|
api_key: editor.apiKey.trim(),
|
||||||
entry_point: DEFAULT_ENTRY_POINT,
|
entry_point: DEFAULT_ENTRY_POINT,
|
||||||
llm_name: editor.llmName,
|
llm_name: editor.llmName,
|
||||||
});
|
});
|
||||||
@@ -578,6 +588,17 @@ export default function App() {
|
|||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
<label>
|
||||||
|
api_key
|
||||||
|
<input
|
||||||
|
type="password"
|
||||||
|
value={editor.apiKey}
|
||||||
|
onChange={(e) => updateEditor("apiKey", e.target.value)}
|
||||||
|
placeholder="Enter provider API key"
|
||||||
|
disabled={busy}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
llm_name
|
llm_name
|
||||||
<input
|
<input
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ export type PipelineCreateRequest = {
|
|||||||
prompt_set_id: string;
|
prompt_set_id: string;
|
||||||
tool_keys: string[];
|
tool_keys: string[];
|
||||||
port: number;
|
port: number;
|
||||||
|
api_key: string;
|
||||||
entry_point: string;
|
entry_point: string;
|
||||||
llm_name: string;
|
llm_name: string;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user