...
This commit is contained in:
65
.drone.yml
65
.drone.yml
@@ -13,3 +13,68 @@ steps:
|
|||||||
commands:
|
commands:
|
||||||
- npm ci
|
- npm ci
|
||||||
- npm run build
|
- 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
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -43,3 +43,5 @@ next-env.d.ts
|
|||||||
deploy.sh
|
deploy.sh
|
||||||
learn-languages.tar.gz
|
learn-languages.tar.gz
|
||||||
src/app/test
|
src/app/test
|
||||||
|
|
||||||
|
.env
|
||||||
@@ -2,6 +2,7 @@ import type { NextConfig } from "next";
|
|||||||
|
|
||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
/* config options here */
|
/* config options here */
|
||||||
|
output: "standalone"
|
||||||
};
|
};
|
||||||
|
|
||||||
export default nextConfig;
|
export default nextConfig;
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { EdgeTTS, ProsodyOptions } from "edge-tts-universal/browser";
|
import { EdgeTTS, ProsodyOptions } from "edge-tts-universal/browser";
|
||||||
import { env } from "process";
|
|
||||||
import { TextSpeakerArraySchema } from "./interfaces";
|
import { TextSpeakerArraySchema } from "./interfaces";
|
||||||
import z from "zod";
|
import z from "zod";
|
||||||
|
|
||||||
@@ -16,7 +15,7 @@ export function inspect(word: string) {
|
|||||||
export function urlGoto(url: string) {
|
export function urlGoto(url: string) {
|
||||||
window.open(url, '_blank');
|
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') {
|
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';
|
const url = 'https://open.bigmodel.cn/api/paas/v4/chat/completions';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user