NanoGPT: Add backend web search

This commit is contained in:
Cohee
2025-07-15 22:47:10 +03:00
parent cd176039ef
commit f8f9ee8a0e
2 changed files with 4 additions and 1 deletions
+1 -1
View File
@@ -1970,7 +1970,7 @@
</span>
</div>
</div>
<div class="range-block" data-source="makersuite,vertexai,aimlapi,openrouter,claude,xai">
<div class="range-block" data-source="makersuite,vertexai,aimlapi,openrouter,claude,xai,nanogpt">
<label for="openai_enable_web_search" class="checkbox_label flexWrap widthFreeExpand">
<input id="openai_enable_web_search" type="checkbox" />
<span data-i18n="Enable web search">Enable web search</span>
@@ -1641,6 +1641,9 @@ router.post('/generate', function (request, response) {
apiKey = readSecret(request.user.directories, SECRET_KEYS.NANOGPT);
headers = {};
bodyParams = {};
if (request.body.enable_web_search && !/:online$/.test(request.body.model)) {
request.body.model = `${request.body.model}:online`;
}
} else if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.ZEROONEAI) {
apiUrl = API_01AI;
apiKey = readSecret(request.user.directories, SECRET_KEYS.ZEROONEAI);