feat: add nomyo inference
This commit is contained in:
parent
73ac813c39
commit
636de792a7
3 changed files with 43 additions and 25 deletions
15
action.yml
15
action.yml
|
|
@ -39,6 +39,10 @@ inputs:
|
|||
description: "Model variant for provider-specific reasoning effort (e.g., high, max, minimal)"
|
||||
required: false
|
||||
|
||||
nomyo_api_key:
|
||||
description: "Nomyo API key"
|
||||
required: true
|
||||
|
||||
nomyo_api_url:
|
||||
description: "Nomyo API base URL. Defaults to https://chat.nomyo.ai/api"
|
||||
required: false
|
||||
|
|
@ -47,3 +51,14 @@ inputs:
|
|||
runs:
|
||||
using: "node20"
|
||||
main: "dist/index.mjs"
|
||||
env:
|
||||
NOMYO_API_KEY: ${{ inputs.nomyo_api_key }}
|
||||
NOMYO_API_URL: ${{ inputs.nomyo_api_url }}
|
||||
MODEL: ${{ inputs.model }}
|
||||
AGENT: ${{ inputs.agent }}
|
||||
SHARE: ${{ inputs.share }}
|
||||
PROMPT: ${{ inputs.prompt }}
|
||||
FORGEJO_API_URL: ${{ inputs.forgejo_api_url }}
|
||||
FORGEJO_TOKEN: ${{ inputs.forgejo_token }}
|
||||
MENTIONS: ${{ inputs.mentions }}
|
||||
VARIANT: ${{ inputs.variant }}
|
||||
|
|
|
|||
40
dist/index.mjs
vendored
40
dist/index.mjs
vendored
File diff suppressed because one or more lines are too long
13
index.ts
13
index.ts
|
|
@ -118,7 +118,7 @@ type IssueQueryResponse = {
|
|||
const HOST = "127.0.0.1"
|
||||
const PORT = 4096
|
||||
const SERVER_URL = `http://${HOST}:${PORT}`
|
||||
let proc: ReturnType<typeof spawn>
|
||||
let proc: ReturnType<typeof spawn> | undefined
|
||||
let accessToken: string
|
||||
let commentId: number
|
||||
let gitConfig: string
|
||||
|
|
@ -128,6 +128,7 @@ let exitCode = 0
|
|||
let forgejoHost: string
|
||||
let forgejoRepoOwner: string
|
||||
let forgejoRepoName: string
|
||||
let authConfigDir: string | undefined
|
||||
type PromptFile = {
|
||||
filename: string
|
||||
mime: string
|
||||
|
|
@ -140,7 +141,7 @@ type PromptFiles = PromptFile[]
|
|||
|
||||
// ─── Auth config ─────────────────────────────────────────────────────────────
|
||||
|
||||
async function createAuthConfig() {
|
||||
async function createAuthConfig(): Promise<string> {
|
||||
const fs = await import("node:fs")
|
||||
const os = await import("node:os")
|
||||
const path = await import("node:path")
|
||||
|
|
@ -157,7 +158,7 @@ async function createAuthConfig() {
|
|||
fs.mkdirSync(configDir, { recursive: true })
|
||||
|
||||
const authConfig = {
|
||||
nomyo: {
|
||||
openai: {
|
||||
type: "api" as const,
|
||||
key: nomyoApiKey,
|
||||
url: nomyoApiUrl,
|
||||
|
|
@ -173,7 +174,7 @@ async function createAuthConfig() {
|
|||
// ─── Entry ───────────────────────────────────────────────────────────────────
|
||||
|
||||
try {
|
||||
const authConfigDir = await createAuthConfig()
|
||||
authConfigDir = await createAuthConfig()
|
||||
process.env["OPENCODE_AUTH_CONFIG_DIR"] = authConfigDir
|
||||
|
||||
proc = spawn(`opencode`, [`serve`, `--hostname=${HOST}`, `--port=${PORT}`])
|
||||
|
|
@ -276,7 +277,9 @@ try {
|
|||
await updateComment(`${msg}${footer()}`)
|
||||
core.setFailed(msg)
|
||||
} finally {
|
||||
proc.kill()
|
||||
if (proc) {
|
||||
proc.kill()
|
||||
}
|
||||
// Clean up auth config directory
|
||||
const fs = await import("node:fs")
|
||||
const path = await import("node:path")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue