]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
server: avoid overwriting Authorization header (#10878)
authorGaetan Bisson <redacted>
Wed, 18 Dec 2024 14:00:07 +0000 (04:00 -1000)
committerGitHub <redacted>
Wed, 18 Dec 2024 14:00:07 +0000 (15:00 +0100)
* server: avoid overwriting Authorization header

If no API key is set, leave the Authorization header as is. It may be
used by another part of the Web stack, such as an authenticating proxy.

Fixes https://github.com/ggerganov/llama.cpp/issues/10854

* rebuild

---------

Co-authored-by: Xuan Son Nguyen <redacted>
examples/server/public/index.html.gz
examples/server/webui/src/main.js

index 01dd41811d083cb3dfdf10860c00cc2b1f003832..6a64915579c39cec4bfdc995b76f9994824cdddc 100644 (file)
Binary files a/examples/server/public/index.html.gz and b/examples/server/public/index.html.gz differ
index 2a3021ce98773dbbfd9b3d31d1d4ed0a7d290acf..997ab0ff5d769632e7542ff093588400abb6877a 100644 (file)
@@ -445,7 +445,7 @@ const mainApp = createApp({
           method: 'POST',
           headers: {
             'Content-Type': 'application/json',
-            'Authorization': this.config.apiKey ? `Bearer ${this.config.apiKey}` : undefined,
+            ...(this.config.apiKey ? {'Authorization': `Bearer ${this.config.apiKey}`} : {})
           },
           body: JSON.stringify(params),
           signal: abortController.signal,