remove tracked files
This commit is contained in:
parent
1e1eaa74ce
commit
663609617f
|
@ -1,67 +0,0 @@
|
||||||
// Code generated by Wire. DO NOT EDIT.
|
|
||||||
|
|
||||||
//go:generate go run -mod=mod github.com/google/wire/cmd/wire
|
|
||||||
//go:build !wireinject
|
|
||||||
// +build !wireinject
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"ai_scheduler/internal/config"
|
|
||||||
"ai_scheduler/internal/services"
|
|
||||||
"ai_scheduler/internal/tools"
|
|
||||||
"ai_scheduler/pkg/ollama"
|
|
||||||
"ai_scheduler/pkg/types"
|
|
||||||
)
|
|
||||||
|
|
||||||
import (
|
|
||||||
_ "ai_scheduler/docs"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Injectors from wire.go:
|
|
||||||
|
|
||||||
// InitializeApp 初始化应用程序
|
|
||||||
func InitializeApp(configPath string) (*App, error) {
|
|
||||||
configConfig, err := config.LoadConfig(configPath)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
aiClient := provideOllamaClient(configConfig)
|
|
||||||
toolsConfig := provideToolsConfig(configConfig)
|
|
||||||
manager := tools.NewManager(toolsConfig)
|
|
||||||
routerService := provideRouterService(aiClient, manager)
|
|
||||||
app := NewApp(configConfig, routerService)
|
|
||||||
return app, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// wire.go:
|
|
||||||
|
|
||||||
// provideOllamaClient 提供Ollama客户端
|
|
||||||
func provideOllamaClient(cfg *config.Config) types.AIClient {
|
|
||||||
client, _ := ollama.NewClient(&cfg.Ollama)
|
|
||||||
return client
|
|
||||||
}
|
|
||||||
|
|
||||||
// provideToolsConfig 提供工具配置
|
|
||||||
func provideToolsConfig(cfg *config.Config) *config.ToolsConfig {
|
|
||||||
return &cfg.Tools
|
|
||||||
}
|
|
||||||
|
|
||||||
// provideRouterService 提供路由服务
|
|
||||||
func provideRouterService(aiClient types.AIClient, toolManager *tools.Manager) types.RouterService {
|
|
||||||
return services.NewRouterService(aiClient, toolManager)
|
|
||||||
}
|
|
||||||
|
|
||||||
// App 应用程序结构
|
|
||||||
type App struct {
|
|
||||||
Config *config.Config
|
|
||||||
RouterService types.RouterService
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewApp 创建应用程序
|
|
||||||
func NewApp(cfg *config.Config, routerService types.RouterService) *App {
|
|
||||||
return &App{
|
|
||||||
Config: cfg,
|
|
||||||
RouterService: routerService,
|
|
||||||
}
|
|
||||||
}
|
|
192
docs/docs.go
192
docs/docs.go
|
@ -1,192 +0,0 @@
|
||||||
// Package docs Code generated by swaggo/swag. DO NOT EDIT
|
|
||||||
package docs
|
|
||||||
|
|
||||||
import "github.com/swaggo/swag"
|
|
||||||
|
|
||||||
const docTemplate = `{
|
|
||||||
"schemes": {{ marshal .Schemes }},
|
|
||||||
"swagger": "2.0",
|
|
||||||
"info": {
|
|
||||||
"description": "{{escape .Description}}",
|
|
||||||
"title": "{{.Title}}",
|
|
||||||
"termsOfService": "http://swagger.io/terms/",
|
|
||||||
"contact": {
|
|
||||||
"name": "API Support",
|
|
||||||
"url": "http://www.swagger.io/support",
|
|
||||||
"email": "support@swagger.io"
|
|
||||||
},
|
|
||||||
"license": {
|
|
||||||
"name": "Apache 2.0",
|
|
||||||
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
|
|
||||||
},
|
|
||||||
"version": "{{.Version}}"
|
|
||||||
},
|
|
||||||
"host": "{{.Host}}",
|
|
||||||
"basePath": "{{.BasePath}}",
|
|
||||||
"paths": {
|
|
||||||
"/api/v1/chat": {
|
|
||||||
"post": {
|
|
||||||
"description": "发送消息给AI助手,支持工具调用",
|
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"chat"
|
|
||||||
],
|
|
||||||
"summary": "智能聊天",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"description": "聊天请求",
|
|
||||||
"name": "request",
|
|
||||||
"in": "body",
|
|
||||||
"required": true,
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/handlers.ChatRequest"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "聊天响应",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/handlers.ChatResponse"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"400": {
|
|
||||||
"description": "请求错误",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/handlers.ErrorResponse"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"500": {
|
|
||||||
"description": "服务器错误",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/handlers.ErrorResponse"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/health": {
|
|
||||||
"get": {
|
|
||||||
"description": "检查服务是否正常运行",
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"system"
|
|
||||||
],
|
|
||||||
"summary": "健康检查",
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "OK",
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"definitions": {
|
|
||||||
"handlers.ChatRequest": {
|
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"message"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"message": {
|
|
||||||
"type": "string",
|
|
||||||
"example": "北京今天天气怎么样?"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"handlers.ChatResponse": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"finished": {
|
|
||||||
"type": "boolean",
|
|
||||||
"example": true
|
|
||||||
},
|
|
||||||
"message": {
|
|
||||||
"type": "string",
|
|
||||||
"example": "北京今天天气晴朗,温度15.3°C"
|
|
||||||
},
|
|
||||||
"tool_calls": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"$ref": "#/definitions/handlers.ToolCallResponse"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"handlers.ErrorResponse": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"code": {
|
|
||||||
"type": "integer",
|
|
||||||
"example": 400
|
|
||||||
},
|
|
||||||
"error": {
|
|
||||||
"type": "string",
|
|
||||||
"example": "Invalid request"
|
|
||||||
},
|
|
||||||
"message": {
|
|
||||||
"type": "string",
|
|
||||||
"example": "请求参数错误"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"handlers.FunctionCallResponse": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"arguments": {},
|
|
||||||
"name": {
|
|
||||||
"type": "string",
|
|
||||||
"example": "get_weather"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"handlers.ToolCallResponse": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"function": {
|
|
||||||
"$ref": "#/definitions/handlers.FunctionCallResponse"
|
|
||||||
},
|
|
||||||
"id": {
|
|
||||||
"type": "string",
|
|
||||||
"example": "call_1"
|
|
||||||
},
|
|
||||||
"result": {},
|
|
||||||
"type": {
|
|
||||||
"type": "string",
|
|
||||||
"example": "function"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}`
|
|
||||||
|
|
||||||
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
|
||||||
var SwaggerInfo = &swag.Spec{
|
|
||||||
Version: "1.0",
|
|
||||||
Host: "localhost:8080",
|
|
||||||
BasePath: "/",
|
|
||||||
Schemes: []string{},
|
|
||||||
Title: "AI Scheduler API",
|
|
||||||
Description: "智能路由调度系统API文档",
|
|
||||||
InfoInstanceName: "swagger",
|
|
||||||
SwaggerTemplate: docTemplate,
|
|
||||||
LeftDelim: "{{",
|
|
||||||
RightDelim: "}}",
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
|
||||||
}
|
|
|
@ -1,168 +0,0 @@
|
||||||
{
|
|
||||||
"swagger": "2.0",
|
|
||||||
"info": {
|
|
||||||
"description": "智能路由调度系统API文档",
|
|
||||||
"title": "AI Scheduler API",
|
|
||||||
"termsOfService": "http://swagger.io/terms/",
|
|
||||||
"contact": {
|
|
||||||
"name": "API Support",
|
|
||||||
"url": "http://www.swagger.io/support",
|
|
||||||
"email": "support@swagger.io"
|
|
||||||
},
|
|
||||||
"license": {
|
|
||||||
"name": "Apache 2.0",
|
|
||||||
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
|
|
||||||
},
|
|
||||||
"version": "1.0"
|
|
||||||
},
|
|
||||||
"host": "localhost:8080",
|
|
||||||
"basePath": "/",
|
|
||||||
"paths": {
|
|
||||||
"/api/v1/chat": {
|
|
||||||
"post": {
|
|
||||||
"description": "发送消息给AI助手,支持工具调用",
|
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"chat"
|
|
||||||
],
|
|
||||||
"summary": "智能聊天",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"description": "聊天请求",
|
|
||||||
"name": "request",
|
|
||||||
"in": "body",
|
|
||||||
"required": true,
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/handlers.ChatRequest"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "聊天响应",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/handlers.ChatResponse"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"400": {
|
|
||||||
"description": "请求错误",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/handlers.ErrorResponse"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"500": {
|
|
||||||
"description": "服务器错误",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/handlers.ErrorResponse"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/health": {
|
|
||||||
"get": {
|
|
||||||
"description": "检查服务是否正常运行",
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"system"
|
|
||||||
],
|
|
||||||
"summary": "健康检查",
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "OK",
|
|
||||||
"schema": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"definitions": {
|
|
||||||
"handlers.ChatRequest": {
|
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"message"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"message": {
|
|
||||||
"type": "string",
|
|
||||||
"example": "北京今天天气怎么样?"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"handlers.ChatResponse": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"finished": {
|
|
||||||
"type": "boolean",
|
|
||||||
"example": true
|
|
||||||
},
|
|
||||||
"message": {
|
|
||||||
"type": "string",
|
|
||||||
"example": "北京今天天气晴朗,温度15.3°C"
|
|
||||||
},
|
|
||||||
"tool_calls": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"$ref": "#/definitions/handlers.ToolCallResponse"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"handlers.ErrorResponse": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"code": {
|
|
||||||
"type": "integer",
|
|
||||||
"example": 400
|
|
||||||
},
|
|
||||||
"error": {
|
|
||||||
"type": "string",
|
|
||||||
"example": "Invalid request"
|
|
||||||
},
|
|
||||||
"message": {
|
|
||||||
"type": "string",
|
|
||||||
"example": "请求参数错误"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"handlers.FunctionCallResponse": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"arguments": {},
|
|
||||||
"name": {
|
|
||||||
"type": "string",
|
|
||||||
"example": "get_weather"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"handlers.ToolCallResponse": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"function": {
|
|
||||||
"$ref": "#/definitions/handlers.FunctionCallResponse"
|
|
||||||
},
|
|
||||||
"id": {
|
|
||||||
"type": "string",
|
|
||||||
"example": "call_1"
|
|
||||||
},
|
|
||||||
"result": {},
|
|
||||||
"type": {
|
|
||||||
"type": "string",
|
|
||||||
"example": "function"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,114 +0,0 @@
|
||||||
basePath: /
|
|
||||||
definitions:
|
|
||||||
handlers.ChatRequest:
|
|
||||||
properties:
|
|
||||||
message:
|
|
||||||
example: 北京今天天气怎么样?
|
|
||||||
type: string
|
|
||||||
required:
|
|
||||||
- message
|
|
||||||
type: object
|
|
||||||
handlers.ChatResponse:
|
|
||||||
properties:
|
|
||||||
finished:
|
|
||||||
example: true
|
|
||||||
type: boolean
|
|
||||||
message:
|
|
||||||
example: 北京今天天气晴朗,温度15.3°C
|
|
||||||
type: string
|
|
||||||
tool_calls:
|
|
||||||
items:
|
|
||||||
$ref: '#/definitions/handlers.ToolCallResponse'
|
|
||||||
type: array
|
|
||||||
type: object
|
|
||||||
handlers.ErrorResponse:
|
|
||||||
properties:
|
|
||||||
code:
|
|
||||||
example: 400
|
|
||||||
type: integer
|
|
||||||
error:
|
|
||||||
example: Invalid request
|
|
||||||
type: string
|
|
||||||
message:
|
|
||||||
example: 请求参数错误
|
|
||||||
type: string
|
|
||||||
type: object
|
|
||||||
handlers.FunctionCallResponse:
|
|
||||||
properties:
|
|
||||||
arguments: {}
|
|
||||||
name:
|
|
||||||
example: get_weather
|
|
||||||
type: string
|
|
||||||
type: object
|
|
||||||
handlers.ToolCallResponse:
|
|
||||||
properties:
|
|
||||||
function:
|
|
||||||
$ref: '#/definitions/handlers.FunctionCallResponse'
|
|
||||||
id:
|
|
||||||
example: call_1
|
|
||||||
type: string
|
|
||||||
result: {}
|
|
||||||
type:
|
|
||||||
example: function
|
|
||||||
type: string
|
|
||||||
type: object
|
|
||||||
host: localhost:8080
|
|
||||||
info:
|
|
||||||
contact:
|
|
||||||
email: support@swagger.io
|
|
||||||
name: API Support
|
|
||||||
url: http://www.swagger.io/support
|
|
||||||
description: 智能路由调度系统API文档
|
|
||||||
license:
|
|
||||||
name: Apache 2.0
|
|
||||||
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
|
||||||
termsOfService: http://swagger.io/terms/
|
|
||||||
title: AI Scheduler API
|
|
||||||
version: "1.0"
|
|
||||||
paths:
|
|
||||||
/api/v1/chat:
|
|
||||||
post:
|
|
||||||
consumes:
|
|
||||||
- application/json
|
|
||||||
description: 发送消息给AI助手,支持工具调用
|
|
||||||
parameters:
|
|
||||||
- description: 聊天请求
|
|
||||||
in: body
|
|
||||||
name: request
|
|
||||||
required: true
|
|
||||||
schema:
|
|
||||||
$ref: '#/definitions/handlers.ChatRequest'
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
responses:
|
|
||||||
"200":
|
|
||||||
description: 聊天响应
|
|
||||||
schema:
|
|
||||||
$ref: '#/definitions/handlers.ChatResponse'
|
|
||||||
"400":
|
|
||||||
description: 请求错误
|
|
||||||
schema:
|
|
||||||
$ref: '#/definitions/handlers.ErrorResponse'
|
|
||||||
"500":
|
|
||||||
description: 服务器错误
|
|
||||||
schema:
|
|
||||||
$ref: '#/definitions/handlers.ErrorResponse'
|
|
||||||
summary: 智能聊天
|
|
||||||
tags:
|
|
||||||
- chat
|
|
||||||
/health:
|
|
||||||
get:
|
|
||||||
description: 检查服务是否正常运行
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
responses:
|
|
||||||
"200":
|
|
||||||
description: OK
|
|
||||||
schema:
|
|
||||||
additionalProperties:
|
|
||||||
type: string
|
|
||||||
type: object
|
|
||||||
summary: 健康检查
|
|
||||||
tags:
|
|
||||||
- system
|
|
||||||
swagger: "2.0"
|
|
Loading…
Reference in New Issue