This commit is contained in:
Anirban Kar 2024-12-03 02:19:30 +05:30
parent 1589d2a8f5
commit 7192690c1c
2 changed files with 0 additions and 20 deletions

View File

@ -1,5 +1,4 @@
import Cookies from 'js-cookie';
import { parseCookies } from './parseCookies';
import type { ModelInfo, OllamaApiResponse, OllamaModel } from './types';
import type { ProviderInfo } from '~/types/model';

View File

@ -1,19 +0,0 @@
export function parseCookies(cookieHeader: string) {
const cookies: any = {};
// Split the cookie string by semicolons and spaces
const items = cookieHeader.split(';').map((cookie) => cookie.trim());
items.forEach((item) => {
const [name, ...rest] = item.split('=');
if (name && rest) {
// Decode the name and value, and join value parts in case it contains '='
const decodedName = decodeURIComponent(name.trim());
const decodedValue = decodeURIComponent(rest.join('=').trim());
cookies[decodedName] = decodedValue;
}
});
return cookies;
}