initial relay scaffold
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
import { sdk } from '../sdk'
|
||||
import { configFile } from '../file-models/config.json'
|
||||
|
||||
const { InputSpec, Value } = sdk
|
||||
|
||||
// Optional Gemma/Ollama endpoint for the operator-hardware analysis
|
||||
// fallback. Counterpart to setParakeetUrl — Parakeet handles transcribe
|
||||
// overflow, this handles analyze overflow.
|
||||
const inputSpec = InputSpec.of({
|
||||
relay_gemma_base_url: Value.text({
|
||||
name: 'Gemma Base URL',
|
||||
description:
|
||||
"URL of the operator's Gemma / Ollama / OpenAI-compatible analysis endpoint. Used as the overflow path once a user exceeds their monthly Gemini cap. Leave empty to hard-cap at the Gemini limit. Example: http://192.168.1.87:11434",
|
||||
required: false,
|
||||
default: '',
|
||||
minLength: 0,
|
||||
maxLength: 256,
|
||||
patterns: [
|
||||
{
|
||||
regex: '^(https?://.+)?$',
|
||||
description: 'Must be empty or start with http:// or https://',
|
||||
},
|
||||
],
|
||||
}),
|
||||
})
|
||||
|
||||
export const setGemmaUrl = sdk.Action.withInput(
|
||||
'set-gemma-url',
|
||||
|
||||
async ({ effects }) => ({
|
||||
name: 'Set Gemma URL',
|
||||
description:
|
||||
'Optional. Where the relay forwards analysis requests once a user exceeds their monthly Gemini cap. Leave empty to disable the fallback.',
|
||||
warning: null,
|
||||
allowedStatuses: 'any',
|
||||
group: null,
|
||||
visibility: 'enabled',
|
||||
}),
|
||||
|
||||
inputSpec,
|
||||
|
||||
async ({ effects }) => {
|
||||
const config = await configFile.read().once()
|
||||
return {
|
||||
relay_gemma_base_url: config?.relay_gemma_base_url || '',
|
||||
}
|
||||
},
|
||||
|
||||
async ({ effects, input }) => {
|
||||
await configFile.merge(effects, {
|
||||
relay_gemma_base_url: (input.relay_gemma_base_url || '').trim(),
|
||||
})
|
||||
return null
|
||||
},
|
||||
)
|
||||
Reference in New Issue
Block a user