Skip to content

Commit aae8792

Browse files
authored
fix(web_search): improve credential retrieval logic in web_search function (#228)
1 parent d55ad50 commit aae8792

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

veadk/tools/builtin_tools/web_search.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,13 @@ def web_search(query: str, tool_context: ToolContext) -> list[str]:
168168
"NeedSummary": True,
169169
}
170170

171-
ak = tool_context.state.get(
172-
"VOLCENGINE_ACCESS_KEY", getenv("VOLCENGINE_ACCESS_KEY")
173-
)
171+
ak = tool_context.state.get("VOLCENGINE_ACCESS_KEY")
172+
if not ak:
173+
ak = getenv("VOLCENGINE_ACCESS_KEY")
174174

175-
sk = tool_context.state.get(
176-
"VOLCENGINE_SECRET_KEY", getenv("VOLCENGINE_SECRET_KEY")
177-
)
175+
sk = tool_context.state.get("VOLCENGINE_SECRET_KEY")
176+
if not sk:
177+
sk = getenv("VOLCENGINE_SECRET_KEY")
178178

179179
now = datetime.datetime.utcnow()
180180
response_body = request(

0 commit comments

Comments
 (0)