chore: change how headers affect
Signed-off-by: Zhiqiang ZHOU <im@strrl.dev>
This commit is contained in:
parent
7a8a38ac6f
commit
aa7775225a
@ -6,7 +6,7 @@
|
||||
"api_key": "",
|
||||
"metadata": {
|
||||
"get_models_url": "https://openrouter.ai/api/v1/models",
|
||||
"header_template": "Authorization: Bearer {{api_key}} HTTP-Referer: https://jan.ai X-Title: Jan",
|
||||
"header_template": "Authorization: Bearer {{api_key}}",
|
||||
"transform_req": {
|
||||
"chat_completions": {
|
||||
"url": "https://openrouter.ai/api/v1/chat/completions",
|
||||
|
||||
@ -129,6 +129,14 @@ export const sendCompletion = async (
|
||||
apiKey: provider.api_key ?? (await invoke('app_token')),
|
||||
// TODO: Retrieve from extension settings
|
||||
baseURL: provider.base_url,
|
||||
// OpenRouter identification headers for Jan
|
||||
// ref: https://openrouter.ai/docs/api-reference/overview#headers
|
||||
...(provider.provider === 'openrouter' && {
|
||||
defaultHeaders: {
|
||||
'HTTP-Referer': 'https://jan.ai',
|
||||
'X-Title': 'Jan',
|
||||
},
|
||||
}),
|
||||
})
|
||||
if (
|
||||
thread.model.id &&
|
||||
@ -277,10 +285,10 @@ export const extractToolCall = (
|
||||
* @param calls
|
||||
* @param builder
|
||||
* @param message
|
||||
* @param content
|
||||
* @param approvedTools - Record of approved tools per thread
|
||||
* @param showModal - Function to show approval modal, returns true if approved
|
||||
* @param allowAllMCPPermissions - Global setting to allow all MCP permissions without modal
|
||||
* @param abortController
|
||||
* @param approvedTools
|
||||
* @param showModal
|
||||
* @param allowAllMCPPermissions
|
||||
*/
|
||||
export const postMessageProcessing = async (
|
||||
calls: ChatCompletionMessageToolCall[],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user