feat: 初始化AI写作工坊项目
- 实现基于Vue 3 + Vite的模块化架构 - 集成DeepSeek API进行内容生成 - 支持写作范式分析功能 - 添加环境变量配置支持 - 完整的项目结构和文档
This commit is contained in:
36
src/utils/config.js
Normal file
36
src/utils/config.js
Normal file
@@ -0,0 +1,36 @@
|
||||
// 环境变量配置
|
||||
export const config = {
|
||||
// API 配置
|
||||
apiUrl: import.meta.env.VITE_API_URL || 'https://api.deepseek.com/chat/completions',
|
||||
apiKey: import.meta.env.VITE_API_KEY || 'YOUR_KEY',
|
||||
|
||||
// 应用配置
|
||||
appVersion: '1.0.0',
|
||||
isDev: import.meta.env.DEV,
|
||||
mode: import.meta.env.MODE
|
||||
}
|
||||
|
||||
// 验证必需的环境变量
|
||||
export const validateConfig = () => {
|
||||
const errors = []
|
||||
|
||||
if (!config.apiUrl) {
|
||||
errors.push('API URL 未配置')
|
||||
}
|
||||
|
||||
if (!config.apiKey || config.apiKey === 'YOUR_KEY') {
|
||||
errors.push('API Key 未配置或使用默认值')
|
||||
}
|
||||
|
||||
return errors
|
||||
}
|
||||
|
||||
// 获取配置摘要(用于调试)
|
||||
export const getConfigSummary = () => {
|
||||
return {
|
||||
apiUrl: config.apiUrl,
|
||||
hasApiKey: config.apiKey !== 'YOUR_KEY',
|
||||
mode: config.mode,
|
||||
isDev: config.isDev
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user