@goodandready/dsh-subscriptions 0.4.21 → 0.4.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/adapter.js +11 -0
- package/lib/index.js +3 -1
- package/lib/ollama.js +11 -0
- package/package.json +1 -1
package/lib/adapter.js
CHANGED
|
@@ -60,6 +60,10 @@ export class SubscriptionAdapter extends LlmAdapter {
|
|
|
60
60
|
return models
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
imageRequestPricing(_provider, _model) {
|
|
64
|
+
return undefined
|
|
65
|
+
}
|
|
66
|
+
|
|
63
67
|
async resolveModel(provider, model, _signal) {
|
|
64
68
|
const rows = await this.listModels(provider)
|
|
65
69
|
const found = rows.find((row) => row && row.id === model)
|
|
@@ -77,6 +81,13 @@ export class SubscriptionAdapter extends LlmAdapter {
|
|
|
77
81
|
return { provider, id: model, name: model }
|
|
78
82
|
}
|
|
79
83
|
|
|
84
|
+
async prepareCall(provider, model, signal) {
|
|
85
|
+
return {
|
|
86
|
+
model: await this.resolveModel(provider, model, signal),
|
|
87
|
+
stream: (options) => this.stream(options),
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
80
91
|
async *stream(options) {
|
|
81
92
|
const provider = options.provider
|
|
82
93
|
const deps = this.deps
|
package/lib/index.js
CHANGED
|
@@ -756,7 +756,9 @@ export function apply(ctx, config) {
|
|
|
756
756
|
return
|
|
757
757
|
}
|
|
758
758
|
const q = queryOf(req)
|
|
759
|
-
const
|
|
759
|
+
const provider = q.get('provider') || ''
|
|
760
|
+
const index = Number(q.get('index') || '1')
|
|
761
|
+
const ref = refForSlot(provider, index)
|
|
760
762
|
if (!ref) { writeJson(res, 404, { ok: false, error: { code: 'slot', message: 'slot not found' } }); return }
|
|
761
763
|
try {
|
|
762
764
|
writeJson(res, 200, { ok: true, ...(await resetCredits.inspect(ref)) })
|
package/lib/ollama.js
CHANGED
|
@@ -45,10 +45,21 @@ export class OllamaAdapter extends LlmAdapter {
|
|
|
45
45
|
return ollamaModels(this.deps.baseUrl(), this.deps.fetchImpl || fetch)
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
imageRequestPricing(_provider, _model) {
|
|
49
|
+
return undefined
|
|
50
|
+
}
|
|
51
|
+
|
|
48
52
|
async resolveModel(provider, model, _signal) {
|
|
49
53
|
return { provider, id: model, name: model }
|
|
50
54
|
}
|
|
51
55
|
|
|
56
|
+
async prepareCall(provider, model, signal) {
|
|
57
|
+
return {
|
|
58
|
+
model: await this.resolveModel(provider, model, signal),
|
|
59
|
+
stream: (options) => this.stream(options),
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
52
63
|
async *stream(options) {
|
|
53
64
|
const base = this.deps.baseUrl()
|
|
54
65
|
const model = options.model || this.deps.fallbackModel() || ''
|
package/package.json
CHANGED