...
Some checks reported errors
continuous-integration/drone/push Build encountered an error
continuous-integration/drone Build is failing

This commit is contained in:
2025-10-14 21:15:25 +08:00
parent 4210517cdd
commit 75ed2c6d12
4 changed files with 75 additions and 8 deletions

View File

@@ -8,8 +8,73 @@ platform:
arch: amd64
steps:
- name: build
image: node:23-alpine
commands:
- npm ci
- npm run build
- name: build
image: node:23-alpine
commands:
- npm ci
- npm run build
- name: package
image: node:23-alpine
environment:
ZHIPU_API_KEY:
from_secret: zhipu_api_key
commands:
- apk add zip
- cd .next/standalone
- echo "ZHIPU_API_KEY="$ZHIPU_API_KEY > .env
- zip -r /dist/learn-languages.zip *
volumes:
- name: debian-dist
path: /dist
- name: transfer file
image: appleboy/drone-scp
settings:
host:
from_secret: SSH_HOST
username:
from_secret: SSH_USERNAME
key:
from_secret: SSH_KEY
port: 22
target: /home/debian
source:
- /dist/learn-languages.zip
rm_target: true
strip_components: 1
debug: true
volumes:
- name: debian-dist
path: /dist
- name: deploy
image: appleboy/drone-ssh
settings:
host:
from_secret: ssh_host
username:
from_secret: ssh_username
key:
from_secret: ssh_key
port: 22
script:
- cd ~/
- unzip -d learn-languages -o learn-languages.zip
- rm learn-languages.zip
- cd learn-languages
- |
if pm2 list | grep -q learn-languages; then
echo "进程 learn-languages 已在pm2中运行正在重启..."
pm2 restart "learn-languages"
else
echo "进程 learn-languages 未在pm2中运行正在启动..."
pm2 start "./server.js" --name "learn-languages"
fi
- pm2 save
debug: true
volumes:
- name: debian-dist
host:
path: /home/debian/dist

4
.gitignore vendored
View File

@@ -42,4 +42,6 @@ next-env.d.ts
deploy.sh
learn-languages.tar.gz
src/app/test
src/app/test
.env

View File

@@ -2,6 +2,7 @@ import type { NextConfig } from "next";
const nextConfig: NextConfig = {
/* config options here */
output: "standalone"
};
export default nextConfig;

View File

@@ -1,5 +1,4 @@
import { EdgeTTS, ProsodyOptions } from "edge-tts-universal/browser";
import { env } from "process";
import { TextSpeakerArraySchema } from "./interfaces";
import z from "zod";
@@ -16,7 +15,7 @@ export function inspect(word: string) {
export function urlGoto(url: string) {
window.open(url, '_blank');
}
const API_KEY = env.ZHIPU_API_KEY;
const API_KEY = process.env.ZHIPU_API_KEY;
export async function callZhipuAPI(messages: { role: string; content: string; }[], model = 'glm-4.5-flash') {
const url = 'https://open.bigmodel.cn/api/paas/v4/chat/completions';