mirror of
https://github.com/JefferyHcool/BiliNote.git
synced 2026-05-11 18:10:06 +08:00
Merge pull request #194 from Paper-Dragon/fixed_local_video
Refine local video form validation and update Docker configuration
This commit is contained in:
@@ -60,21 +60,29 @@ const formSchema = z
|
|||||||
.optional(),
|
.optional(),
|
||||||
})
|
})
|
||||||
.superRefine(({ video_url, platform }, ctx) => {
|
.superRefine(({ video_url, platform }, ctx) => {
|
||||||
if (platform === 'local' && !video_url) {
|
if (platform === 'local') {
|
||||||
ctx.addIssue({ code: 'custom', message: '本地视频路径不能为空', path: ['video_url'] })
|
if (!video_url) {
|
||||||
} else if (!video_url) {
|
ctx.addIssue({ code: 'custom', message: '本地视频路径不能为空', path: ['video_url'] })
|
||||||
ctx.addIssue({ code: 'custom', message: '视频链接不能为空', path: ['video_url'] })
|
}
|
||||||
} else {
|
}
|
||||||
try {
|
else {
|
||||||
const url = new URL(video_url)
|
if (!video_url) {
|
||||||
if (!['http:', 'https:'].includes(url.protocol)) throw new Error()
|
ctx.addIssue({ code: 'custom', message: '视频链接不能为空', path: ['video_url'] })
|
||||||
} catch {
|
}
|
||||||
ctx.addIssue({ code: 'custom', message: '请输入正确的视频链接', path: ['video_url'] })
|
else {
|
||||||
|
try {
|
||||||
|
const url = new URL(video_url)
|
||||||
|
if (!['http:', 'https:'].includes(url.protocol))
|
||||||
|
throw new Error()
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
ctx.addIssue({ code: 'custom', message: '请输入正确的视频链接', path: ['video_url'] })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
type NoteFormValues = z.infer<typeof formSchema>
|
export type NoteFormValues = z.infer<typeof formSchema>
|
||||||
|
|
||||||
/* -------------------- 可复用子组件 -------------------- */
|
/* -------------------- 可复用子组件 -------------------- */
|
||||||
const SectionHeader = ({ title, tip }: { title: string; tip?: string }) => (
|
const SectionHeader = ({ title, tip }: { title: string; tip?: string }) => (
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
FROM nvidia/cuda:12.6.0-cudnn-runtime-ubuntu24.04
|
FROM nvidia/cuda:12.4.1-cudnn-runtime-ubuntu22.04
|
||||||
|
|
||||||
RUN apt update && \
|
RUN apt update && \
|
||||||
apt install -y ffmpeg python3-pip && \
|
apt install -y ffmpeg python3-pip && \
|
||||||
apt clean all
|
apt clean all && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# 设置 Hugging Face 镜像源环境变量
|
# 设置 Hugging Face 镜像源环境变量
|
||||||
ENV HF_ENDPOINT=https://hf-mirror.com
|
ENV HF_ENDPOINT=https://hf-mirror.com
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY ./backend /app
|
COPY ./backend /app
|
||||||
RUN pip install --no-cache-dir -i https://pypi.mirrors.ustc.edu.cn/simple -r requirements.txt --break-system-packages
|
RUN pip install --no-cache-dir -i https://pypi.mirrors.ustc.edu.cn/simple -r requirements.txt
|
||||||
RUN pip install --no-cache-dir -i https://pypi.mirrors.ustc.edu.cn/simple transformers[torch]>=4.23 --break-system-packages
|
RUN pip install --no-cache-dir -i https://pypi.mirrors.ustc.edu.cn/simple 'transformers[torch]>=4.23'
|
||||||
|
|
||||||
CMD ["python3", "main.py"]
|
CMD ["python3", "main.py"]
|
||||||
|
|||||||
Reference in New Issue
Block a user