Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d898e92935 | |||
| 12d7403a0e | |||
| babe599977 | |||
| c662a2e362 | |||
| 7a79cd45be |
@@ -1,3 +1,5 @@
|
|||||||
|
import https from 'https';
|
||||||
|
|
||||||
export const GITEA_TOKEN = process.env.GITEA_TOKEN || '';
|
export const GITEA_TOKEN = process.env.GITEA_TOKEN || '';
|
||||||
export const GITEA_COMMENT_TOKEN = process.env.GITEA_COMMENT_TOKEN || '';
|
export const GITEA_COMMENT_TOKEN = process.env.GITEA_COMMENT_TOKEN || '';
|
||||||
export const GITEA_SERVER_URL = process.env.GITEA_SERVER_URL || 'https://gitea.com';
|
export const GITEA_SERVER_URL = process.env.GITEA_SERVER_URL || 'https://gitea.com';
|
||||||
@@ -15,6 +17,10 @@ export function shouldSkipOpenCodeTLSVerify() {
|
|||||||
return process.env.OPENCODE_SKIP_TLS_VERIFY === 'true';
|
return process.env.OPENCODE_SKIP_TLS_VERIFY === 'true';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getOpenCodeHttpsAgent() {
|
||||||
|
return shouldSkipOpenCodeTLSVerify() ? new https.Agent({ rejectUnauthorized: false }) : undefined;
|
||||||
|
}
|
||||||
|
|
||||||
/** 將逗號分隔的 API key 字串拆成陣列 */
|
/** 將逗號分隔的 API key 字串拆成陣列 */
|
||||||
function splitKeys(value) {
|
function splitKeys(value) {
|
||||||
if (!value) return [];
|
if (!value) return [];
|
||||||
|
|||||||
+2
-3
@@ -1,6 +1,5 @@
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import https from 'https';
|
import { getLLMConfig, getOpenCodeHttpsAgent } from './config.js';
|
||||||
import { getLLMConfig, shouldSkipOpenCodeTLSVerify } from './config.js';
|
|
||||||
import { line, error } from './log.js';
|
import { line, error } from './log.js';
|
||||||
|
|
||||||
function isOpenAIGpt55(provider, model) {
|
function isOpenAIGpt55(provider, model) {
|
||||||
@@ -50,7 +49,7 @@ function applyOpenCodeAuth(headers) {
|
|||||||
function opencodeAxiosOptions(headers) {
|
function opencodeAxiosOptions(headers) {
|
||||||
return {
|
return {
|
||||||
headers,
|
headers,
|
||||||
httpsAgent: shouldSkipOpenCodeTLSVerify() ? new https.Agent({ rejectUnauthorized: false }) : undefined,
|
httpsAgent: getOpenCodeHttpsAgent(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -7,8 +7,8 @@ import {
|
|||||||
GITEA_REPOSITORY,
|
GITEA_REPOSITORY,
|
||||||
GITEA_SKIP_TLS_VERIFY,
|
GITEA_SKIP_TLS_VERIFY,
|
||||||
PR_NUMBER,
|
PR_NUMBER,
|
||||||
|
getOpenCodeHttpsAgent,
|
||||||
getLLMConfig,
|
getLLMConfig,
|
||||||
shouldSkipOpenCodeTLSVerify,
|
|
||||||
} from './config.js';
|
} from './config.js';
|
||||||
import { verifyRemoteAccess } from './git.js';
|
import { verifyRemoteAccess } from './git.js';
|
||||||
import { step, line, ok, error } from './log.js';
|
import { step, line, ok, error } from './log.js';
|
||||||
@@ -30,7 +30,7 @@ const applyOpenCodeAuth = (headers) => {
|
|||||||
const opencodeAxiosOptions = (headers) => ({
|
const opencodeAxiosOptions = (headers) => ({
|
||||||
headers,
|
headers,
|
||||||
timeout: 30000,
|
timeout: 30000,
|
||||||
httpsAgent: shouldSkipOpenCodeTLSVerify() ? new https.Agent({ rejectUnauthorized: false }) : undefined,
|
httpsAgent: getOpenCodeHttpsAgent(),
|
||||||
});
|
});
|
||||||
|
|
||||||
function giteaErr(e) {
|
function giteaErr(e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user