refactor: 更新音频文件路径和UI样式调整

fix: 修正TTS提供商配置中的null值问题
chore: 清理无用文件和更新输入文本内容
This commit is contained in:
hex2077
2025-08-20 14:18:18 +08:00
parent a7ef2d6606
commit d3bd3fdff2
26 changed files with 125 additions and 207 deletions

View File

@@ -14,7 +14,7 @@ export async function GET(request: NextRequest) {
}
// 构建文件路径
const outputDir = path.join(process.cwd(), '..', 'output');
const outputDir = path.join(process.cwd(), '..', 'server', 'output');
const filePath = path.join(outputDir, filename);
try {

View File

@@ -22,7 +22,11 @@ export async function GET() {
}
// 缓存无效或不存在,读取文件并更新缓存
const configPath = path.join(process.cwd(), '..', 'config', 'tts_providers.json');
const ttsProvidersName = process.env.TTS_PROVIDERS_NAME;
if (!ttsProvidersName) {
throw new Error('TTS_PROVIDERS_NAME 环境变量未设置');
}
const configPath = path.join(process.cwd(), '..', 'config', ttsProvidersName);
const configContent = await fs.readFile(configPath, 'utf-8');
const config = JSON.parse(configContent);

View File

@@ -14,20 +14,24 @@ export const metadata: Metadata = {
description: '使用AI技术将您的想法和内容转换为高质量的播客音频支持多种语音和风格选择。',
keywords: ['播客', 'AI', '语音合成', 'TTS', '音频生成'],
authors: [{ name: 'PodcastHub Team' }],
viewport: 'width=device-width, initial-scale=1',
themeColor: '#000000',
icons: {
icon: '/favicon.webp',
apple: '/favicon.webp',
},
openGraph: {
title: 'PodcastHub - 给创意一个真实的声音',
description: '使用AI技术将您的想法和内容转换为高质量的播客音频',
description: '使用AI技术将您的想法和内容转换为高质量的播客音频,支持多种语音和风格选择。',
type: 'website',
locale: 'zh_CN',
},
};
export const viewport = {
themeColor: '#000000',
width: 'device-width',
initialScale: 1,
};
export default function RootLayout({
children,
}: {

View File

@@ -100,7 +100,7 @@ export default async function PodcastContent({ fileName }: PodcastContentProps)
</div>
{/* 标题 */}
<h1 className="text-3xl md:text-4xl font-bold text-gray-900 leading-tight break-words">
<h1 className="text-3xl md:text-3xl font-bold text-gray-900 leading-tight break-words">
{audioInfo.title}
</h1>

View File

@@ -157,17 +157,34 @@ const PodcastCreator: React.FC<PodcastCreatorProps> = ({
<div className="flex items-center justify-center gap-3 mb-4">
<svg className="h-[80px] w-[300px] sm:h-[100px] sm:w-[600px]" viewBox="0 0 600 150" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="waveGradient" x1="49" y1="98" x2="140" y2="98" gradientUnits="userSpaceOnUse">
<stop stop-color="#8E54E9"/>
<stop offset="1" stop-color="#C26AE6"/>
<linearGradient id="waveGradient" x1="0" y1="0" x2="140" y2="0" gradientUnits="userSpaceOnUse">
<stop stopColor="#D869E5">
<animate attributeName="stop-color" values="#D069E6;#FB866C;#FA6F7E;#E968E2;" dur="5s" repeatCount="indefinite"/>
</stop>
<stop offset="1" stopColor="#D069E6">
<animate attributeName="stop-color" values="#FB866C;#FA6F7E;#E968E2;#D869E5;" dur="5s" repeatCount="indefinite"/>
</stop>
</linearGradient>
<linearGradient id="textGradient" x1="175" y1="0" x2="810" y2="0" gradientUnits="userSpaceOnUse">
<stop offset="0.05" stop-color="#D069E6"/>
<stop offset="0.35" stop-color="#FB866C"/>
<stop offset="0.55" stop-color="#FA6F7E"/>
<stop offset="0.85" stop-color="#E968E2"/>
<stop offset="1" stop-color="#D869E5"/>
<linearGradient id="textGradient" x1="600" y1="0" x2="150" y2="0" gradientUnits="userSpaceOnUse">
<stop offset="0" stopColor="#C75AD4">
<animate attributeName="stop-color" values="#C75AD4;#D85AD1;#F85F6F;#F9765B;#C15ED5;#C75AD4" dur="10s" repeatCount="indefinite" />
</stop>
<stop offset="0.1818" stopColor="#D85AD1">
<animate attributeName="stop-color" values="#D85AD1;#F85F6F;#F9765B;#C15ED5;#C75AD4;#D85AD1" dur="10s" repeatCount="indefinite" />
</stop>
<stop offset="0.3636" stopColor="#F85F6F">
<animate attributeName="stop-color" values="#F85F6F;#F9765B;#C15ED5;#C75AD4;#D85AD1;#F85F6F" dur="10s" repeatCount="indefinite" />
</stop>
<stop offset="0.5455" stopColor="#F9765B">
<animate attributeName="stop-color" values="#F9765B;#C15ED5;#C75AD4;#D85AD1;#F85F6F;#F9765B" dur="10s" repeatCount="indefinite" />
</stop>
<stop offset="0.7273" stopColor="#C15ED5">
<animate attributeName="stop-color" values="#C15ED5;#C75AD4;#D85AD1;#F85F6F;#F9765B;#C15ED5" dur="10s" repeatCount="indefinite" />
</stop>
<stop offset="0.9091" stopColor="#C75AD4">
<animate attributeName="stop-color" values="#C75AD4;#D85AD1;#F85F6F;#F9765B;#C15ED5;#C75AD4" dur="10s" repeatCount="indefinite" />
</stop>
</linearGradient>
</defs>

View File

@@ -139,21 +139,6 @@ const Sidebar: React.FC<SidebarProps> = ({
{/* 品牌名称容器 - 慢慢收缩动画 */}
<div className="overflow-hidden transition-all duration-500 ease-in-out w-auto ">
<svg className="h-[30px] w-[180px] sm:h-[30px] sm:w-[180px]" viewBox="0 0 800 150" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="waveGradient" x1="49" y1="98" x2="140" y2="98" gradientUnits="userSpaceOnUse">
<stop stop-color="#8E54E9"/>
<stop offset="1" stop-color="#C26AE6"/>
</linearGradient>
<linearGradient id="textGradient" x1="175" y1="0" x2="810" y2="0" gradientUnits="userSpaceOnUse">
<stop offset="0.05" stop-color="#D069E6"/>
<stop offset="0.35" stop-color="#FB866C"/>
<stop offset="0.55" stop-color="#FA6F7E"/>
<stop offset="0.85" stop-color="#E968E2"/>
<stop offset="1" stop-color="#D869E5"/>
</linearGradient>
</defs>
<g>
<path
d="M49 98.5 C 56 56.5, 65 56.5, 73 90.5 C 79 120.5, 85 125.5, 91 100.5 C 96 80.5, 100 75.5, 106 95.5 C 112 115.5, 118 108.5, 125 98.5"

View File

@@ -82,7 +82,7 @@ const Toast: React.FC<ToastProps> = ({
return (
<div
className={cn(
"flex items-start gap-3 p-4 rounded-lg shadow-lg bg-white border border-gray-200 backdrop-blur-md max-w-sm w-full transition-all duration-300 ease-in-out",
"flex items-start gap-3 p-4 rounded-lg shadow-lg bg-white border border-gray-200 backdrop-blur-md max-w-sm w-full transition-all duration-300 ease-in-out pointer-events-auto",
getAccentColor(), // 添加左侧强调色边框
isVisible && !isLeaving ? "translate-y-0 opacity-100" : "-translate-y-4 opacity-0" // 向上弹出动画
)}
@@ -121,7 +121,7 @@ const Toast: React.FC<ToastProps> = ({
onRemove,
}) => {
return (
<div className="fixed top-4 left-1/2 -translate-x-1/2 z-50 w-full max-w-md pointer-events-none p-4 flex flex-col items-center space-y-3"> {/* 定位到顶部水平居中并限制宽度使用flex布局垂直居中增加间距 */}
<div className="fixed top-4 left-1/2 -translate-x-1/2 z-50 w-full max-w-md p-4 flex flex-col items-center space-y-3"> {/* 定位到顶部水平居中并限制宽度使用flex布局垂直居中增加间距 */}
{toasts.map((toast) => (
<Toast
key={toast.id}