网讯创智模型管理平台

mengboxin137-blip b64c432343 fix: text-embedding 原生模式 input 格式改为 {"texts": [...]} 8 stundas atpakaļ
admin-frontend 183bbeefd6 fix: admin 前端 VITE_API_BASE 使用 ?? 替代 || 支持空字符串 10 stundas atpakaļ
backend b64c432343 fix: text-embedding 原生模式 input 格式改为 {"texts": [...]} 8 stundas atpakaļ
docs 6e7c0d8350 feat: 初始化 Maas-Model-platform 项目 1 dienu atpakaļ
frontend 200df6e383 fix: 创建 clipboard.ts 工具函数文件 9 stundas atpakaļ
phone 6e7c0d8350 feat: 初始化 Maas-Model-platform 项目 1 dienu atpakaļ
results 6e7c0d8350 feat: 初始化 Maas-Model-platform 项目 1 dienu atpakaļ
skills 6e7c0d8350 feat: 初始化 Maas-Model-platform 项目 1 dienu atpakaļ
ui 6e7c0d8350 feat: 初始化 Maas-Model-platform 项目 1 dienu atpakaļ
.env 2a20f4051f fix: 一次性修复所有环境变量和数据库字段缺失问题 9 stundas atpakaļ
.gitignore 6e7c0d8350 feat: 初始化 Maas-Model-platform 项目 1 dienu atpakaļ
Dockerfile a258627097 fix: admin 前端 VITE_API_BASE 设为空字符串走 nginx 代理 10 stundas atpakaļ
README.md 6e7c0d8350 feat: 初始化 Maas-Model-platform 项目 1 dienu atpakaļ
UPDATE_NOTES.md 6e7c0d8350 feat: 初始化 Maas-Model-platform 项目 1 dienu atpakaļ
docker-compose.yml 2a20f4051f fix: 一次性修复所有环境变量和数据库字段缺失问题 9 stundas atpakaļ
jmeter.log 6e7c0d8350 feat: 初始化 Maas-Model-platform 项目 1 dienu atpakaļ
nginx.conf 992e529df7 fix: nginx 管理后台改用 root 替代 alias 修复 JS MIME 类型错误 11 stundas atpakaļ
obfuscate_non_billing.py 6e7c0d8350 feat: 初始化 Maas-Model-platform 项目 1 dienu atpakaļ
upload_client.py 6e7c0d8350 feat: 初始化 Maas-Model-platform 项目 1 dienu atpakaļ
{.txt 6e7c0d8350 feat: 初始化 Maas-Model-platform 项目 1 dienu atpakaļ
统一认证平台接入流程及API接口文档(1)(1).md 6e7c0d8350 feat: 初始化 Maas-Model-platform 项目 1 dienu atpakaļ

README.md

AIGC Space - AI模型广场

一个集成多种AI功能的综合平台,支持文本对话、图像生成、音频合成、视频生成等多种AI服务。

🌟 核心功能

💬 智能对话

  • 支持多种大语言模型(Qwen、DeepSeek、Kimi等)
  • 🔍 联网搜索功能 - 实时信息检索,获取最新数据
  • 多轮对话记录和管理
  • 流式输出支持

🎨 图像生成

  • 多种AI绘画模型支持
  • 自定义参数调节
  • 批量生成和管理

🎵 音频合成

  • 文本转语音(TTS)
  • 语音克隆
  • 多种音色选择

🎬 视频生成

  • AI视频合成
  • 多种视频模型支持

🔍 联网搜索功能亮点

实时信息检索

  • 获取最新的网络信息,解决训练数据时效性限制
  • 支持天气、股票、汇率等垂直领域的精准查询
  • 多种搜索策略:turbo(快速)、max(详尽)、agent(智能)

高级功能

  • 引用和溯源: 提供搜索来源URL和引用标注
  • 流式搜索: 完全兼容流式对话模式
  • 自然语言搜索控制: 精确控制搜索范围和方向
  • 优雅降级: 搜索失败时自动降级到普通对话模式

支持的垂直领域

  • 🌤️ 天气预报
  • 📈 股票行情
  • 💱 汇率查询
  • ⛽ 油价信息
  • 📅 万年历
  • 🥇 金价银价
  • 🎲 彩票开奖
  • 🎬 影视资讯
  • 🚗 车牌限行
  • ⚽ 足球赛事

🚀 快速开始

环境要求

  • Python 3.11+
  • Node.js 16+
  • PostgreSQL 13+

后端启动

cd backend

# 安装依赖
pip install -r requirements.txt

# 配置环境变量
cp .env.example .env
# 编辑 .env 文件,配置数据库和API密钥

# 配置搜索功能(可选)
export DASHSCOPE_API_KEY="your_dashscope_api_key"
export LLM_SEARCH_ENABLED=true

# 数据库迁移
python scripts/apply_search_migrations.py

# 启动服务
uvicorn main:app --host 0.0.0.0 --port 8000 --reload

前端启动

cd frontend

# 安装依赖
npm install

# 启动开发服务器
npm run dev

搜索功能配置检查

cd backend
python scripts/check_search_config.py

📖 文档

搜索功能文档

其他文档

🔧 技术栈

后端

  • FastAPI - 现代化的Python Web框架
  • SQLAlchemy - ORM数据库操作
  • PostgreSQL - 主数据库
  • 阿里云百炼 - LLM服务和联网搜索
  • Hypothesis - 属性测试框架

前端

  • React - 用户界面框架
  • TypeScript - 类型安全的JavaScript
  • Vite - 现代化构建工具
  • Tailwind CSS - 实用优先的CSS框架

🧪 测试

运行后端测试

cd backend

# 运行所有测试
python -m pytest

# 运行搜索功能测试
python -m pytest tests/test_*search*.py -v

# 运行属性测试
python -m pytest tests/test_property_*.py -v

运行前端测试

cd frontend
npm test

📊 API示例

基础对话

curl -X POST "http://localhost:8000/api/llm/chat" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-plus",
    "messages": [{"role": "user", "content": "你好"}]
  }'

联网搜索对话

curl -X POST "http://localhost:8000/api/llm/chat" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-plus",
    "messages": [{"role": "user", "content": "今天北京天气怎么样?"}],
    "search_options": {
      "enable_search": true,
      "enable_search_extension": true,
      "enable_source": true
    }
  }'

垂直领域搜索

curl -X POST "http://localhost:8000/api/llm/chat" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-plus", 
    "messages": [{"role": "user", "content": "美元兑人民币汇率"}],
    "search_options": {
      "enable_search": true,
      "enable_search_extension": true,
      "search_strategy": "turbo"
    }
  }'

🔍 搜索功能使用示例

Python代码示例

from app.schemas.llm_schema import SearchOptions, EnhancedChatRequest, ChatMessage

# 创建搜索增强的对话请求
request = EnhancedChatRequest(
    model="qwen-plus",
    messages=[ChatMessage(role="user", content="最新AI技术发展")],
    search_options=SearchOptions(
        enable_search=True,
        search_strategy="turbo",
        freshness=7,  # 搜索最近7天的内容
        enable_source=True,  # 返回搜索来源
        enable_citation=True,  # 启用引用标注
        intention_options={
            "prompt_intervene": "重点搜索AI技术突破和大语言模型发展"
        }
    )
)

JavaScript前端示例

const response = await fetch('/api/llm/chat', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    model: 'qwen-plus',
    messages: [{ role: 'user', content: '2024年人工智能有哪些突破?' }],
    search_options: {
      enable_search: true,
      search_strategy: 'max',
      enable_source: true,
      enable_citation: true,
      citation_format: '[ref_<number>]'
    }
  })
});

const result = await response.json();
console.log('AI回复:', result.data.content);
console.log('搜索来源:', result.data.search_results);

🛠️ 开发

项目结构

├── backend/                 # 后端服务
│   ├── app/                # 应用代码
│   │   ├── models/         # 数据模型
│   │   ├── routers/        # API路由
│   │   ├── services/       # 业务逻辑
│   │   └── schemas/        # 数据模式
│   ├── docs/               # 后端文档
│   ├── examples/           # 代码示例
│   ├── tests/              # 测试代码
│   └── migrations/         # 数据库迁移
├── frontend/               # 前端应用
│   ├── components/         # React组件
│   ├── pages/              # 页面组件
│   ├── services/           # API服务
│   └── types/              # TypeScript类型
└── docs/                   # 项目文档

搜索功能架构

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   Frontend      │    │   LLM Service   │    │  DashScope API  │
│                 │    │                 │    │                 │
│ Search Options  │───▶│ Search Options  │───▶│ Web Search      │
│ UI Components   │    │ Validator       │    │ Vertical Domain │
│                 │    │                 │    │                 │
└─────────────────┘    └─────────────────┘    └─────────────────┘
                              │
                              ▼
                       ┌─────────────────┐
                       │ Citation        │
                       │ Formatter       │
                       └─────────────────┘

🤝 贡献

欢迎贡献代码!请遵循以下步骤:

  1. Fork 项目
  2. 创建功能分支 (git checkout -b feature/AmazingFeature)
  3. 提交更改 (git commit -m 'Add some AmazingFeature')
  4. 推送到分支 (git push origin feature/AmazingFeature)
  5. 开启 Pull Request

开发规范

  • 后端代码遵循 PEP 8 规范
  • 前端代码使用 ESLint 和 Prettier
  • 提交信息使用约定式提交格式
  • 新功能需要包含测试用例
  • 重要功能需要更新文档

📄 许可证

本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情。

🙏 致谢

📞 联系我们


开始使用搜索功能: 查看 搜索功能快速开始指南 快速上手!