ai: add gpt 5 nano via gh models

This commit is contained in:
end-4 2025-08-15 22:07:56 +07:00
parent dbed431085
commit 661fcfd263
2 changed files with 53 additions and 31 deletions

View file

@ -132,44 +132,50 @@ Singleton {
"openai": {
"functions": [
{
"name": "switch_to_search_mode",
"description": "Search the web",
"type": "function",
"function": {
"name": "get_shell_config",
"description": "Get the desktop shell config file contents",
"parameters": {}
},
},
{
"name": "get_shell_config",
"description": "Get the desktop shell config file contents",
},
{
"name": "set_shell_config",
"description": "Set a field in the desktop graphical shell config file. Must only be used after `get_shell_config`.",
"parameters": {
"type": "object",
"properties": {
"key": {
"type": "string",
"description": "The key to set, e.g. `bar.borderless`. MUST NOT BE GUESSED, use `get_shell_config` to see what keys are available before setting.",
"type": "function",
"function": {
"name": "set_shell_config",
"description": "Set a field in the desktop graphical shell config file. Must only be used after `get_shell_config`.",
"parameters": {
"type": "object",
"properties": {
"key": {
"type": "string",
"description": "The key to set, e.g. `bar.borderless`. MUST NOT BE GUESSED, use `get_shell_config` to see what keys are available before setting.",
},
"value": {
"type": "string",
"description": "The value to set, e.g. `true`"
}
},
"value": {
"type": "string",
"description": "The value to set, e.g. `true`"
}
},
"required": ["key", "value"]
"required": ["key", "value"]
}
}
},
{
"name": "run_shell_command",
"description": "Run a shell command in bash and get its output. Use this only for quick commands that don't require user interaction. For commands that require interaction, ask the user to run manually instead.",
"parameters": {
"type": "object",
"properties": {
"command": {
"type": "string",
"description": "The bash command to run",
"type": "function",
"function": {
"name": "run_shell_command",
"description": "Run a shell command in bash and get its output. Use this only for quick commands that don't require user interaction. For commands that require interaction, ask the user to run manually instead.",
"parameters": {
"type": "object",
"properties": {
"command": {
"type": "string",
"description": "The bash command to run",
},
},
},
"required": ["command"]
}
"required": ["command"]
}
},
},
],
"search": [],
@ -313,6 +319,19 @@ Singleton {
"key_get_description": Translation.tr("**Instructions**: Log into Mistral account, go to Keys on the sidebar, click Create new key"),
"api_format": "mistral",
}),
"github-gpt-5-nano": aiModelComponent.createObject(this, {
"name": "GPT-5 Nano (GH Models)",
"icon": "github-symbolic",
"api_format": "openai",
"description": Translation.tr("Online via %1 | %2's model").arg("GitHub Models").arg("OpenAI"),
"homepage": "https://github.com/marketplace/models",
"endpoint": "https://models.inference.ai.azure.com/chat/completions",
"model": "gpt-5-nano",
"requires_key": true,
"key_id": "github",
"key_get_link": "https://github.com/settings/tokens",
"key_get_description": Translation.tr("**Pricing**: Free tier available with limited rates. See https://docs.github.com/en/billing/concepts/product-billing/github-models\n\n**Instructions**: Generate a GitHub personal access token with Models permission, then set as API key here\n\n**Note**: To use this you will have to set the temperature parameter to 1"),
}),
"openrouter-deepseek-r1": aiModelComponent.createObject(this, {
"name": "DeepSeek R1",
"icon": "deepseek-symbolic",

View file

@ -21,6 +21,7 @@ ApiStrategy {
}),
],
"stream": true,
"tools": tools,
"temperature": temperature,
};
return model.extraParams ? Object.assign({}, baseData, model.extraParams) : baseData;
@ -36,6 +37,8 @@ ApiStrategy {
if (cleanData.startsWith("data:")) {
cleanData = cleanData.slice(5).trim();
}
// console.log("[AI] OpenAI: Data:", cleanData);
// Handle special cases
if (!cleanData || cleanData.startsWith(":")) return {};