|
|
преди 11 часа | |
|---|---|---|
| admin-frontend | преди 16 часа | |
| backend | преди 11 часа | |
| docs | преди 1 ден | |
| frontend | преди 12 часа | |
| phone | преди 1 ден | |
| results | преди 1 ден | |
| skills | преди 1 ден | |
| ui | преди 1 ден | |
| .env | преди 12 часа | |
| .gitignore | преди 1 ден | |
| Dockerfile | преди 12 часа | |
| README.md | преди 1 ден | |
| UPDATE_NOTES.md | преди 1 ден | |
| docker-compose.yml | преди 11 часа | |
| jmeter.log | преди 1 ден | |
| nginx.conf | преди 11 часа | |
| obfuscate_non_billing.py | преди 1 ден | |
| upload_client.py | преди 1 ден | |
| {.txt | преди 1 ден | |
| 统一认证平台接入流程及API接口文档(1)(1).md | преди 1 ден |
一个集成多种AI功能的综合平台,支持文本对话、图像生成、音频合成、视频生成等多种AI服务。
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
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
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"
}
}'
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技术突破和大语言模型发展"
}
)
)
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 │
└─────────────────┘
欢迎贡献代码!请遵循以下步骤:
git checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情。
开始使用搜索功能: 查看 搜索功能快速开始指南 快速上手!