feat: add nomyo inference

This commit is contained in:
Alpha Nerd 2026-05-11 13:09:04 +02:00
parent 73ac813c39
commit 636de792a7
Signed by: alpha-nerd
SSH key fingerprint: SHA256:QkkAgVoYi9TQ0UKPkiKSfnerZy2h4qhi3SVPXJmBN+M
3 changed files with 43 additions and 25 deletions

View file

@ -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")