Added ability to override request payload
| @@ -82,7 +82,6 @@ export class TextCompletionService { | ||
| 82 | 82 | */ |
| 83 | 83 | static createRequestData({ stream = false, prompt, max_tokens, model, api_type, api_server, temperature, min_p, ...props }) { |
| 84 | 84 | const payload = { |
| 85 | - ...props, | |
| 86 | 85 | stream, |
| 87 | 86 | prompt, |
| 88 | 87 | max_tokens, |
| @@ -92,6 +91,7 @@ export class TextCompletionService { | ||
| 92 | 91 | api_server: api_server ?? getTextGenServer(api_type), |
| 93 | 92 | temperature, |
| 94 | 93 | min_p, |
| 94 | + ...props, | |
| 95 | 95 | }; |
| 96 | 96 | |
| 97 | 97 | // Remove undefined values to avoid API errors |
| @@ -391,7 +391,6 @@ export class ChatCompletionService { | ||
| 391 | 391 | */ |
| 392 | 392 | static createRequestData({ stream = false, messages, model, chat_completion_source, max_tokens, temperature, custom_url, reverse_proxy, proxy_password, ...props }) { |
| 393 | 393 | const payload = { |
| 394 | - ...props, | |
| 395 | 394 | stream, |
| 396 | 395 | messages, |
| 397 | 396 | model, |
| @@ -401,6 +400,9 @@ export class ChatCompletionService { | ||
| 401 | 400 | custom_url, |
| 402 | 401 | reverse_proxy, |
| 403 | 402 | proxy_password, |
| 403 | + use_makersuite_sysprompt: true, | |
| 404 | + claude_use_sysprompt: true, | |
| 405 | + ...props, | |
| 404 | 406 | }; |
| 405 | 407 | |
| 406 | 408 | // Remove undefined values to avoid API errors |
| @@ -306,9 +306,10 @@ export class ConnectionManagerRequestService { | ||
| 306 | 306 | * @param {boolean?} [custom.includePreset=true] |
| 307 | 307 | * @param {boolean?} [custom.includeInstruct=true] |
| 308 | 308 | * @param {Partial<InstructSettings>?} [custom.instructSettings] Override instruct settings |
| 309 | + * @param {Record<string, any>} [overridePayload] - Override payload for the request | |
| 309 | 310 | * @returns {Promise<import('../custom-request.js').ExtractedData | (() => AsyncGenerator<import('../custom-request.js').StreamResponse>)>} If not streaming, returns extracted data; if streaming, returns a function that creates an AsyncGenerator |
| 310 | 311 | */ |
| 311 | 312 | static async sendRequest(profileId, prompt, maxTokens, custom = this.defaultSendRequestParams, overridePayload = {}) { |
| 312 | 313 | const { stream, signal, extractData, includePreset, includeInstruct, instructSettings } = { ...this.defaultSendRequestParams, ...custom }; |
| 313 | 314 | |
| 314 | 315 | const context = SillyTavern.getContext(); |
| @@ -338,6 +339,7 @@ export class ConnectionManagerRequestService { | ||
| 338 | 339 | custom_url: profile['api-url'], |
| 339 | 340 | reverse_proxy: proxyPreset?.url, |
| 340 | 341 | proxy_password: proxyPreset?.password, |
| 342 | + ...overridePayload, | |
| 341 | 343 | }, { |
| 342 | 344 | presetName: includePreset ? profile.preset : undefined, |
| 343 | 345 | }, extractData, signal); |
| @@ -354,6 +356,7 @@ export class ConnectionManagerRequestService { | ||
| 354 | 356 | model: profile.model, |
| 355 | 357 | api_type: selectedApiMap.type, |
| 356 | 358 | api_server: profile['api-url'], |
| 359 | + ...overridePayload, | |
| 357 | 360 | }, { |
| 358 | 361 | instructName: includeInstruct ? profile.instruct : undefined, |
| 359 | 362 | presetName: includePreset ? profile.preset : undefined, |