Files
prompt-optimizer/docs/examples/openai.example.json
T
linshen 9a4de02438 feat: 完成上下文编辑器重构、组件清理与文档整合
此次提交整合了上下文编辑器的大规模重构、废弃组件的清理以及workspace文档的更新,旨在提升系统性能、代码可维护性和开发体验。

### 主要更新
- **上下文编辑器重构**:
    - 移除 ConversationMessageEditor, ConversationSection 等废弃组件。
    - 清理 ConversationManager 和 ContextEditor 未使用的 props。
    - 实现无障碍功能增强和焦点管理。
    - 创建新的工具 composables 和组件类型。
    - 添加全面的测试覆盖和性能监控。

- **组件与代码清理**:
    - 移除重构前的 `VariableManager.vue` 组件及其导出(497行),由 `VariableManagerModal.vue` 替代。
    - 删除已废弃的 `AdvancedTestPanel.vue` 组件及其导出,已被 `TestAreaPanel` 统一组件完全替代。
    - 清理未使用的 `VariableImportExport.vue` 组件、相关测试文件和类型定义。
    - 遵循 YAGNI 原则,确保移除的组件在任何地方均未被使用。
    - 构建包大小减少约 55KB(3552KB -> 3497KB)。

- **Workspace文档整合**:
    - 归档完整的 Naive UI 迁移项目 (包含8个综合文档)。
    - 补充上下文编辑器重构缺失的spec工作流文档。
    - 建立 `docs/examples/` 目录提供配置模板。
    - 更新归档 `INDEX.md` 多维度快速查找索引。
    - 清理 workspace 目录中15个重复文档。

### 技术改进与优化
- 优化 Git 配置,将 `tsconfig.tsbuildinfo` 从追踪中移除并增强 `.gitignore` 规则覆盖所有 `tsbuildinfo` 文件。
- 添加高级 TypeScript 类型和组件接口,实现工具调用显示和变量导入导出组件。
- 增强变量管理与编辑器集成,并保持 `VariableManager.ts` 服务层(仍在使用)。
- 添加全面的单元测试和e2e测试覆盖,改进开发文档和API指南。
- 所有现有功能完整性验证通过,无构建错误或运行时错误。
2025-09-06 23:45:42 +08:00

63 lines
2.5 KiB
JSON

{
"model": "gpt-4-1106-preview",
"messages": [
{
"role": "system",
"content": "You are a professional database schema analyst. Your task is to analyze the following database schema and generate optimized SQL queries based on user requests. The database contains information about customers, orders, and products. Please provide detailed explanations for your queries and suggest performance optimizations when necessary. Use the provided schema structure to ensure accuracy."
},
{
"role": "user",
"content": "Please analyze this database schema and help me write a query to find the top 10 customers by total order value in the last 6 months."
},
{
"role": "assistant",
"content": "I'll help you create a query to find the top 10 customers by total order value in the last 6 months. Let me break this down:\n\n```sql\nSELECT \n c.customer_id,\n c.customer_name,\n SUM(o.total_amount) as total_order_value\nFROM customers c\nJOIN orders o ON c.customer_id = o.customer_id\nWHERE o.order_date >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)\nGROUP BY c.customer_id, c.customer_name\nORDER BY total_order_value DESC\nLIMIT 10;\n```\n\nThis query:\n1. Joins customers and orders tables\n2. Filters for orders in the last 6 months\n3. Groups by customer to sum their order values\n4. Orders by total value descending\n5. Limits to top 10 results"
}
],
"tools": [
{
"type": "function",
"function": {
"name": "execute_sql",
"description": "Execute SQL queries against the database",
"parameters": {
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "The SQL query to execute"
},
"database": {
"type": "string",
"description": "The target database name"
}
},
"required": ["query"]
}
}
},
{
"type": "function",
"function": {
"name": "get_schema_info",
"description": "Retrieve database schema information",
"parameters": {
"type": "object",
"properties": {
"table_name": {
"type": "string",
"description": "Specific table name to get schema for, or 'all' for entire schema"
}
},
"required": ["table_name"]
}
}
}
],
"temperature": 0.1,
"max_tokens": 2000,
"top_p": 1,
"frequency_penalty": 0,
"presence_penalty": 0,
"stream": false
}