Gaston895 commited on
Commit
2a41fd5
Β·
verified Β·
1 Parent(s): a260770

Upload 2 files

Browse files
Files changed (2) hide show
  1. gss-sdk.js +6 -1
  2. server.js +9 -0
gss-sdk.js CHANGED
@@ -40,7 +40,7 @@ class GSSClient {
40
  this.apiKey = opts.apiKey;
41
  this.cfWorkerUrl = opts.cfWorkerUrl.replace(/\/$/, '');
42
  this.hfEngineUrl = opts.hfEngineUrl.replace(/\/$/, '');
43
- this.model = opts.model || 'llama-3.3-70b-versatile';
44
  this.storageKey = opts.storageKey || 'gss_jwt';
45
  this._token = null;
46
  }
@@ -123,6 +123,11 @@ class GSSClient {
123
  max_tokens: opts.max_tokens ?? 1024,
124
  };
125
 
 
 
 
 
 
126
  const res = await fetch(`${this.hfEngineUrl}/v1/chat/completions`, {
127
  method: 'POST',
128
  headers: {
 
40
  this.apiKey = opts.apiKey;
41
  this.cfWorkerUrl = opts.cfWorkerUrl.replace(/\/$/, '');
42
  this.hfEngineUrl = opts.hfEngineUrl.replace(/\/$/, '');
43
+ this.model = opts.model || 'llama-3.1-8b-instant';
44
  this.storageKey = opts.storageKey || 'gss_jwt';
45
  this._token = null;
46
  }
 
123
  max_tokens: opts.max_tokens ?? 1024,
124
  };
125
 
126
+ // Route to Ollama if provider specified
127
+ if (opts.provider) {
128
+ body.provider = opts.provider;
129
+ }
130
+
131
  const res = await fetch(`${this.hfEngineUrl}/v1/chat/completions`, {
132
  method: 'POST',
133
  headers: {
server.js CHANGED
@@ -18,10 +18,19 @@
18
 
19
  const express = require('express');
20
  const jwt = require('jsonwebtoken');
 
21
 
22
  const app = express();
23
  app.use(express.json({ limit: '4mb' }));
24
 
 
 
 
 
 
 
 
 
25
  // ── CORS ──────────────────────────────────────────────────────────────────────
26
  app.use((req, res, next) => {
27
  res.setHeader('Access-Control-Allow-Origin', '*');
 
18
 
19
  const express = require('express');
20
  const jwt = require('jsonwebtoken');
21
+ const path = require('path');
22
 
23
  const app = express();
24
  app.use(express.json({ limit: '4mb' }));
25
 
26
+ // ── Serve SDK files statically ────────────────────────────────────────────────
27
+ app.use('/sdk', express.static(path.join(__dirname, 'sdk')));
28
+
29
+ // Also serve gss-sdk.js directly from root for convenience
30
+ app.get('/gss-sdk.js', (_req, res) => {
31
+ res.sendFile(path.join(__dirname, 'gss-sdk.js'));
32
+ });
33
+
34
  // ── CORS ──────────────────────────────────────────────────────────────────────
35
  app.use((req, res, next) => {
36
  res.setHeader('Access-Control-Allow-Origin', '*');