Skip to content

Commit 84e2897

Browse files
author
Sinan Karakaya
committed
clean: replaced authToken by bearerToken
1 parent e87c99a commit 84e2897

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/modules/lineGenerator.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
export async function* lineGenerator(url: string, data: any, authToken: string): AsyncGenerator<string> {
1+
export async function* lineGenerator(url: string, data: any, bearerToken: string): AsyncGenerator<string> {
22
// Request
33
const controller = new AbortController();
44
let res = await fetch(url, {
55
method: 'POST',
66
body: JSON.stringify(data),
7-
headers: authToken ? {
7+
headers: bearerToken ? {
88
'Content-Type': 'application/json',
9-
Authorization: `Bearer ${authToken}`,
9+
Authorization: `Bearer ${bearerToken}`,
1010
} : {
1111
'Content-Type': 'application/json',
1212
},

src/modules/ollamaCheckModel.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { info } from "./log";
22

3-
export async function ollamaCheckModel(endpoint: string, model: string, authToken: string) {
3+
export async function ollamaCheckModel(endpoint: string, model: string, bearerToken: string) {
44
// Check if exists
55
let res = await fetch(endpoint + '/api/tags', {
6-
headers: authToken ? {
7-
Authorization: `Bearer ${authToken}`,
6+
headers: bearerToken ? {
7+
Authorization: `Bearer ${bearerToken}`,
88
} : {},
99
});
1010
if (!res.ok) {

src/modules/ollamaDownloadModel.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { lineGenerator } from "./lineGenerator";
22
import { info } from "./log";
33

4-
export async function ollamaDownloadModel(endpoint: string, model: string, authToken: string) {
4+
export async function ollamaDownloadModel(endpoint: string, model: string, bearerToken: string) {
55
info('Downloading model from ollama: ' + model);
6-
for await (let line of lineGenerator(endpoint + '/api/pull', { name: model }, authToken)) {
6+
for await (let line of lineGenerator(endpoint + '/api/pull', { name: model }, bearerToken)) {
77
info('[DOWNLOAD] ' + line);
88
}
99
}

src/modules/ollamaTokenGenerator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ export type OllamaToken = {
77
done: boolean
88
};
99

10-
export async function* ollamaTokenGenerator(url: string, data: any, authToken: string): AsyncGenerator<OllamaToken> {
11-
for await (let line of lineGenerator(url, data, authToken)) {
10+
export async function* ollamaTokenGenerator(url: string, data: any, bearerToken: string): AsyncGenerator<OllamaToken> {
11+
for await (let line of lineGenerator(url, data, bearerToken)) {
1212
info('Receive line: ' + line);
1313
let parsed: OllamaToken;
1414
try {

0 commit comments

Comments
 (0)