Compare commits
109 Commits
feat/telem
...
release/v0
| Author | SHA1 | Date | |
|---|---|---|---|
| 31b379bfbe | |||
| fc39fe5a1e | |||
| aae865dafb | |||
| 77e1931494 | |||
| 5562800958 | |||
| 263a75b1c0 | |||
| 901d0252e8 | |||
| 5ecdddbacb | |||
| 2a704fc873 | |||
| f19761fa31 | |||
| 14ce6bc112 | |||
| 6fa2acf05a | |||
| fc47e4096c | |||
| 035ed2450b | |||
| 0fef5a1634 | |||
| f09c624988 | |||
| 59c1d9aa03 | |||
| 19c63a1150 | |||
| 09d00c26cb | |||
| 3d53aaa785 | |||
| 5044cb2b85 | |||
| e7070b419c | |||
| f956c18a09 | |||
| a4b11729a6 | |||
| 1dc00e4df8 | |||
| 5e9740c047 | |||
| f940edf585 | |||
| 23a468c72c | |||
| 85e6926a14 | |||
| a9b87c188b | |||
| ee03b41ad5 | |||
| 18e45b333f | |||
| f040a511e4 | |||
| dfa9eb44e1 | |||
| 4ff734f15f | |||
| ff00dcb31b | |||
| 710bbbff2b | |||
| a734d9d8af | |||
| 174da78c78 | |||
| d58783b11c | |||
| 3030d4d627 | |||
| c79ee64fe8 | |||
| 8994cec367 | |||
| dce313b8e3 | |||
| 5d98e8ef93 | |||
| 8c3ae99643 | |||
| e0800abb99 | |||
| ffbc108875 | |||
| 6b60c07c22 | |||
| 708a6ed0c0 | |||
| 99c759addc | |||
| b38ab95623 | |||
| 9ff065cebd | |||
| e7011f2549 | |||
| 643a448157 | |||
| e03cf4cc87 | |||
| e344828933 | |||
| ad18b9cc42 | |||
| 6501e9aef6 | |||
| 462183cdf1 | |||
| b19ae505f0 | |||
| a44e566bda | |||
| efc6e55fe5 | |||
| a21e41b89d | |||
| 7697b6fb47 | |||
| a3f68cfa01 | |||
| c5f052892a | |||
| 8712be6a6b | |||
| c3e4947270 | |||
| e7d25319ff | |||
| b25bf6728a | |||
| 8cc2a7768c | |||
| e2b1f6e381 | |||
| efbc82e8b3 | |||
| 3c7dfc906f | |||
| c3e0e7045a | |||
| 45e5b6ed26 | |||
| dd079b7ac7 | |||
| 60285ca014 | |||
| 8b91a640b9 | |||
| a179748877 | |||
| fa0daada8a | |||
| 8d1cc2e03a | |||
| f693da17ef | |||
| 28cefbd25e | |||
| a9bfcd5484 | |||
| 6c559d44ca | |||
| b17db0f32b | |||
| 218c1806ff | |||
| 117b63f661 | |||
| 4b3042359c | |||
| 90b561c3df | |||
| 8848ad3ff4 | |||
| c9c900adb0 | |||
| c11780b28d | |||
| ab0ce50df5 | |||
| d4d0ba6b9a | |||
| bb6ff0026b | |||
| 5dafd81a3f | |||
| f02c08c58b | |||
| 0367e66eca | |||
| 38b63f00a3 | |||
| 72656e4fd1 | |||
| f80d4f757b | |||
| 36923bd0a4 | |||
| adc5986d13 | |||
| c7bf6bbdec | |||
| a44b4e8f7e | |||
| f78d297311 |
36
.dockerignore
Normal file
36
.dockerignore
Normal file
@ -0,0 +1,36 @@
|
||||
# Exclude node_modules directories
|
||||
**/node_modules
|
||||
**/node_modules/**
|
||||
|
||||
# Exclude build artifacts
|
||||
**/dist
|
||||
**/build
|
||||
**/.rush/temp
|
||||
**/.rush/build-cache
|
||||
**/common/temp
|
||||
|
||||
# Exclude development files
|
||||
**/.git
|
||||
**/.gitignore
|
||||
**/.eslintrc*
|
||||
**/.prettierrc*
|
||||
**/*.log
|
||||
|
||||
# Exclude test files
|
||||
**/__tests__
|
||||
**/*.test.*
|
||||
**/*.spec.*
|
||||
|
||||
# Exclude documentation
|
||||
**/README.md
|
||||
**/CHANGELOG.md
|
||||
**/docs
|
||||
|
||||
# Exclude IDE files
|
||||
**/.vscode
|
||||
**/.idea
|
||||
**/*.swp
|
||||
**/*.swo
|
||||
*.iml
|
||||
*.iws
|
||||
*.ipr
|
||||
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -11,6 +11,10 @@ on:
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
strategy:
|
||||
|
||||
121
.github/workflows/ci@backend.yml
vendored
Normal file
121
.github/workflows/ci@backend.yml
vendored
Normal file
@ -0,0 +1,121 @@
|
||||
name: Backend Tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'backend/**'
|
||||
- 'docker/atlas/**'
|
||||
- '.github/workflows/ci@backend.yml'
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'backend/**'
|
||||
- 'docker/atlas/**'
|
||||
- '.github/workflows/ci@backend.yml'
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
|
||||
env:
|
||||
DEFAULT_GO_VERSION: "1.24"
|
||||
|
||||
jobs:
|
||||
backend-unit-test:
|
||||
name: backend-unit-test
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
repository-projects: write
|
||||
env:
|
||||
COVERAGE_FILE: coverage.out
|
||||
BREAKDOWN_FILE: main.breakdown
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.DEFAULT_GO_VERSION }}
|
||||
|
||||
# - name: Shutdown Ubuntu MySQL
|
||||
# run: service mysql stop
|
||||
|
||||
- name: Set Up MySQL
|
||||
uses: mirromutth/mysql-action@v1.1
|
||||
with:
|
||||
host port: 3306
|
||||
container port: 3306
|
||||
character set server: 'utf8mb4'
|
||||
collation server: 'utf8mb4_general_ci'
|
||||
mysql version: '8.4.5'
|
||||
mysql database: 'opencoze'
|
||||
mysql root password: 'root'
|
||||
|
||||
- name: Verify MySQL Startup
|
||||
run: |
|
||||
echo "Waiting for MySQL to be ready..."
|
||||
for i in {1..60}; do
|
||||
if cat /proc/net/tcp | grep 0CEA; then
|
||||
echo "MySQL port 3306 is listening!"
|
||||
break
|
||||
fi
|
||||
echo "Waiting for MySQL port... ($i/60)"
|
||||
sleep 1
|
||||
done
|
||||
echo "Final verification: MySQL port 3306 is accessible"
|
||||
|
||||
- name: Install MySQL Client
|
||||
run: sudo apt-get update && sudo apt-get install -y mysql-client
|
||||
|
||||
- name: Initialize Database
|
||||
run: mysql -h 127.0.0.1 -P 3306 -u root -proot opencoze < docker/volumes/mysql/schema.sql
|
||||
|
||||
- name: Run Go Test
|
||||
run: |
|
||||
modules=`find . -name "go.mod" -exec dirname {} \;`
|
||||
echo $modules
|
||||
list=""
|
||||
coverpkg=""
|
||||
if [[ ! -f "go.work" ]];then go work init;fi
|
||||
for module in $modules; do go work use $module; list=$module"/... "$list; coverpkg=$module"/...,"$coverpkg; done
|
||||
go work sync
|
||||
go test -race -v -coverprofile=${{ env.COVERAGE_FILE }} -gcflags="all=-l -N" -coverpkg=$coverpkg $list
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
name: coze-studio-backend
|
||||
env_vars: GOLANG,Coze-Studio,BACKEND
|
||||
fail_ci_if_error: 'false'
|
||||
files: ${{ env.COVERAGE_FILE }}
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
- name: Shutdown MySQL
|
||||
if: always()
|
||||
continue-on-error: true
|
||||
run: docker rm -f $(docker ps -q --filter "ancestor=mysql:8.4.5")
|
||||
benchmark-test:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
repository-projects: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ env.DEFAULT_GO_VERSION }}
|
||||
|
||||
- name: Run Go Benchmark
|
||||
run: |
|
||||
modules=`find . -name "go.mod" -exec dirname {} \;`
|
||||
echo $modules
|
||||
list=""
|
||||
coverpkg=""
|
||||
if [[ ! -f "go.work" ]];then go work init;fi
|
||||
for module in $modules; do go work use $module; list=$module"/... "$list; coverpkg=$module"/...,"$coverpkg; done
|
||||
go work sync
|
||||
go test -race -v -bench=. -benchmem -run=none -gcflags="all=-l -N" $list
|
||||
4
.github/workflows/ci@main.yml
vendored
4
.github/workflows/ci@main.yml
vendored
@ -12,6 +12,10 @@ on:
|
||||
- 'rush.json'
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
|
||||
3
.github/workflows/common-pr-checks.yml
vendored
3
.github/workflows/common-pr-checks.yml
vendored
@ -9,6 +9,9 @@ on:
|
||||
- 'rush.json'
|
||||
types: [opened, edited, synchronize, reopened]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
common-checks:
|
||||
name: PR Common Checks
|
||||
|
||||
3
.github/workflows/idl.yaml
vendored
3
.github/workflows/idl.yaml
vendored
@ -12,6 +12,9 @@ on:
|
||||
- 'idl/**'
|
||||
- '.github/workflows/idl.yaml'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
validate-thrift:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
3
.github/workflows/license-check.yaml
vendored
3
.github/workflows/license-check.yaml
vendored
@ -7,6 +7,9 @@ on:
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
license-check:
|
||||
name: License Check
|
||||
|
||||
3
.github/workflows/semantic-pull-request.yaml
vendored
3
.github/workflows/semantic-pull-request.yaml
vendored
@ -11,6 +11,9 @@ concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
pull-requests: read
|
||||
|
||||
jobs:
|
||||
main:
|
||||
name: Check Pull Request Title
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -34,6 +34,7 @@ output/*
|
||||
|
||||
# Vscode files
|
||||
.vscode/settings.json
|
||||
.vscode/launch.json
|
||||
|
||||
/patches
|
||||
/oldimpl
|
||||
|
||||
11
.mcp.json
Normal file
11
.mcp.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"github": {
|
||||
"type": "http",
|
||||
"url": "https://api.githubcopilot.com/mcp/",
|
||||
"headers": {
|
||||
"Authorization": "Bearer ${GITHUB_PAT}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
196
CLAUDE.md
Normal file
196
CLAUDE.md
Normal file
@ -0,0 +1,196 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Project Overview
|
||||
|
||||
Coze Studio is an all-in-one AI agent development platform with both frontend (React + TypeScript) and backend (Go) components. The project uses a sophisticated monorepo architecture managed by Rush.js with 135+ frontend packages organized in a hierarchical dependency system.
|
||||
|
||||
## Development Commands
|
||||
|
||||
### Environment Setup
|
||||
```bash
|
||||
# Clone and setup
|
||||
git clone https://github.com/coze-dev/coze-studio.git
|
||||
cd coze-studio
|
||||
|
||||
# Install frontend dependencies
|
||||
rush update
|
||||
|
||||
# For Docker-based development
|
||||
cd docker
|
||||
cp .env.example .env
|
||||
# Configure model settings in backend/conf/model/
|
||||
docker compose up -d
|
||||
# Access at http://localhost:8888
|
||||
```
|
||||
|
||||
### Development Workflow
|
||||
```bash
|
||||
# Start middleware services (MySQL, Redis, Elasticsearch, etc.)
|
||||
make middleware
|
||||
|
||||
# Start Go backend in development mode
|
||||
make server
|
||||
|
||||
# Start frontend development server
|
||||
cd frontend/apps/coze-studio
|
||||
npm run dev
|
||||
|
||||
# Full development environment
|
||||
make debug
|
||||
```
|
||||
|
||||
### Build Commands
|
||||
```bash
|
||||
# Build frontend only
|
||||
make fe
|
||||
|
||||
# Build Go server
|
||||
make build_server
|
||||
|
||||
# Build everything with Docker
|
||||
make web
|
||||
|
||||
# Rush monorepo commands
|
||||
rush build # Build all packages
|
||||
rush rebuild -o @coze-studio/app # Build specific package
|
||||
rush test # Run all tests
|
||||
rush lint # Lint all packages
|
||||
```
|
||||
|
||||
### Testing
|
||||
```bash
|
||||
# Run tests (Vitest-based)
|
||||
rush test
|
||||
npm run test # In specific package
|
||||
npm run test:cov # With coverage
|
||||
|
||||
# Backend tests
|
||||
cd backend && go test ./...
|
||||
```
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
### Frontend Architecture
|
||||
- **Monorepo**: Rush.js with 135+ packages across 4 dependency levels
|
||||
- **Build System**: Rsbuild (Rspack-based) for fast builds
|
||||
- **UI Framework**: React 18 + TypeScript + Semi Design + Tailwind CSS
|
||||
- **State Management**: Zustand for global state
|
||||
- **Package Organization**:
|
||||
- `arch/`: Core infrastructure (level-1)
|
||||
- `common/`: Shared components and utilities (level-2)
|
||||
- `agent-ide/`, `workflow/`, `studio/`: Feature domains (level-3)
|
||||
- `apps/coze-studio`: Main application (level-4)
|
||||
|
||||
### Backend Architecture (Go)
|
||||
- **Framework**: Hertz HTTP framework
|
||||
- **Architecture**: Domain-Driven Design (DDD) with microservices
|
||||
- **Structure**:
|
||||
- `domain/`: Business logic and entities
|
||||
- `application/`: Application services and use cases
|
||||
- `api/`: HTTP handlers and routing
|
||||
- `infra/`: Infrastructure implementations
|
||||
- `crossdomain/`: Cross-cutting concerns
|
||||
|
||||
### Key Architectural Patterns
|
||||
- **Adapter Pattern**: Extensive use for loose coupling between layers
|
||||
- **Interface Segregation**: Clear contracts between domains
|
||||
- **Event-Driven**: NSQ message queue for async communication
|
||||
- **API-First**: Comprehensive OpenAPI specifications
|
||||
|
||||
## Database & Infrastructure
|
||||
|
||||
### Docker Services Stack
|
||||
- **Database**: MySQL 8.4.5
|
||||
- **Cache**: Redis 8.0
|
||||
- **Search**: Elasticsearch 8.18.0 with SmartCN analyzer
|
||||
- **Vector DB**: Milvus v2.5.10 for embeddings
|
||||
- **Storage**: MinIO for object storage
|
||||
- **Message Queue**: NSQ (nsqlookupd, nsqd, nsqadmin)
|
||||
- **Configuration**: etcd 3.5
|
||||
|
||||
### Database Management
|
||||
```bash
|
||||
# Sync database schema
|
||||
make sync_db
|
||||
|
||||
# Dump database schema
|
||||
make dump_db
|
||||
|
||||
# Initialize SQL data
|
||||
make sql_init
|
||||
|
||||
# Atlas migration management
|
||||
make atlas-hash
|
||||
```
|
||||
|
||||
## Key Development Patterns
|
||||
|
||||
### Frontend Package Development
|
||||
- Each package follows consistent structure with `README.md`, `package.json`, `tsconfig.json`, `eslint.config.js`
|
||||
- Adapter pattern extensively used for decoupling (e.g., `-adapter` suffix packages)
|
||||
- Base/Core pattern for shared functionality (e.g., `-base` suffix packages)
|
||||
- Use workspace references (`workspace:*`) for internal dependencies
|
||||
|
||||
### Backend Development
|
||||
- Follow DDD principles with clear domain boundaries
|
||||
- Use dependency injection via interfaces
|
||||
- Implement proper error handling with custom error types
|
||||
- Write comprehensive tests for domain logic
|
||||
|
||||
### Model Configuration
|
||||
Before deployment, configure AI models in `backend/conf/model/`:
|
||||
1. Copy template from `backend/conf/model/template/`
|
||||
2. Set `id`, `meta.conn_config.api_key`, and `meta.conn_config.model`
|
||||
3. Supported providers: OpenAI, Volcengine Ark, Claude, Gemini, Qwen, DeepSeek, Ollama
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
### Coverage Requirements by Package Level
|
||||
- **Level 1**: 80% coverage, 90% increment
|
||||
- **Level 2**: 30% coverage, 60% increment
|
||||
- **Level 3-4**: 0% coverage (flexible)
|
||||
|
||||
### Testing Framework
|
||||
- **Frontend**: Vitest for unit/integration tests
|
||||
- **Backend**: Go's built-in testing framework
|
||||
- **E2E**: Separate e2e subspace configuration
|
||||
|
||||
## Common Issues & Solutions
|
||||
|
||||
### Frontend Development
|
||||
- Use `rush update` instead of `npm install` at root level
|
||||
- Build packages in dependency order using `rush build`
|
||||
- For hot reload issues, check Rsbuild configuration in specific package
|
||||
|
||||
### Backend Development
|
||||
- Ensure middleware services are running (`make middleware`)
|
||||
- Check database connectivity and schema sync
|
||||
- Verify model configurations are properly set
|
||||
|
||||
### Docker Issues
|
||||
- Ensure sufficient resources (minimum 2 Core, 4GB RAM)
|
||||
- Check port conflicts (8888 for frontend, various for services)
|
||||
- Use `make clean` to reset Docker volumes if needed
|
||||
|
||||
## IDL and Code Generation
|
||||
|
||||
The project uses Interface Definition Language (IDL) for API contract management:
|
||||
- IDL files in `idl/` directory (Thrift format)
|
||||
- Frontend code generation via `@coze-arch/idl2ts-*` packages
|
||||
- Backend uses generated Go structs
|
||||
|
||||
## Plugin Development
|
||||
|
||||
For custom plugin development:
|
||||
- Reference templates in `backend/conf/plugin/pluginproduct/`
|
||||
- Follow OAuth schema in `backend/conf/plugin/common/oauth_schema.json`
|
||||
- Configure authentication keys for third-party services
|
||||
|
||||
## Contributing
|
||||
|
||||
- Use conventional commits via `rush commit`
|
||||
- Run linting with `rush lint-staged` (pre-commit hook)
|
||||
- Ensure tests pass before submitting PRs
|
||||
- Follow team-based package organization and tagging conventions
|
||||
3
Makefile
3
Makefile
@ -28,7 +28,7 @@ fe:
|
||||
@echo "Building frontend..."
|
||||
@bash $(BUILD_FE_SCRIPT)
|
||||
|
||||
server: env setup_es_index
|
||||
server: env
|
||||
@if [ ! -d "$(STATIC_DIR)" ]; then \
|
||||
echo "Static directory '$(STATIC_DIR)' not found, building frontend..."; \
|
||||
$(MAKE) fe; \
|
||||
@ -116,6 +116,7 @@ help:
|
||||
@echo " middleware - Setup middlewares docker environment, but exclude the server app."
|
||||
@echo " web - Setup web docker environment, include middlewares docker."
|
||||
@echo " down - Stop the docker containers."
|
||||
@echo " down_web - Stop the web docker containers."
|
||||
@echo " clean - Stop the docker containers and clean volumes."
|
||||
@echo " python - Setup python environment."
|
||||
@echo " atlas-hash - Rehash atlas migration files."
|
||||
|
||||
12
README.md
12
README.md
@ -37,7 +37,6 @@ The backend of Coze Studio is developed using Golang, the frontend uses React +
|
||||
|
||||
## Quickstart
|
||||
Learn how to obtain and deploy the open-source version of Coze Studio, quickly build projects, and experience Coze Studio's open-source version.
|
||||
> Detailed steps and deployment requirements can be found in [Quickstart](https://github.com/coze-dev/coze-studio/wiki/2.-Quickstart).
|
||||
|
||||
Environment requirements:
|
||||
|
||||
@ -63,9 +62,10 @@ Deployment steps:
|
||||
2. Modify the template file in the configuration file directory.
|
||||
1. Enter the directory `backend/conf/model`. Open the file `ark_doubao-seed-1.6.yaml`.
|
||||
2. Set the fields `id`, `meta.conn_config.api_key`, `meta.conn_config.model`, and save the file.
|
||||
* **id**: The model ID in Coze Studio, defined by the developers themselves, must be a non-zero integer and globally unique. Do not modify the model ID after the model goes online.
|
||||
* **meta.conn_config.api_key**: The API Key for the model service, which in this example is the API Key for Volcengine Ark. Refer to [Retrieve Volcengine Ark API Key](https://www.volcengine.com/docs/82379/1541594) for the acquisition method.
|
||||
* **meta.conn_config.model**: The model ID of the model service, which in this example is the Endpoint ID of the Volcengine Ark doubao-seed-1.6 model access point. For retrieval methods, refer to [Retrieve Endpoint ID](https://www.volcengine.com/docs/82379/1099522).
|
||||
* **id**: The model ID in Coze Studio, defined by the developer, must be a non-zero integer and globally unique. Agents or workflows call models based on model IDs. For models that have already been launched, do not modify their IDs; otherwise, it may result in model call failures.
|
||||
* **meta.conn_config.api_key**: The API Key for the model service. In this example, it is the API Key for Ark API Key. For more information, see [Get Volcengine Ark API Key](https://www.volcengine.com/docs/82379/1541594) or [Get BytePlus ModelArk API Key](https://docs.byteplus.com/en/docs/ModelArk/1361424?utm_source=github&utm_medium=readme&utm_campaign=coze_open_source).
|
||||
* **meta.conn_config.model**: The Model name for the model service. In this example, it refers to the Model ID or Endpoint ID of Ark. For more information, see [Get Volcengine Ark Model ID](https://www.volcengine.com/docs/82379/1513689) / [Get Volcengine Ark Endpoint ID](https://www.volcengine.com/docs/82379/1099522) or [Get BytePlus ModelArk Model ID](https://docs.byteplus.com/en/docs/ModelArk/model_id?utm_source=github&utm_medium=readme&utm_campaign=coze_open_source) / [Get BytePlus ModelArk Endpoint ID](https://docs.byteplus.com/en/docs/ModelArk/1099522?utm_source=github&utm_medium=readme&utm_campaign=coze_open_source).
|
||||
> For users in China, you may use Volcengine Ark; for users outside China, you may use BytePlus ModelArk instead.
|
||||
3. Deploy and start the service.
|
||||
When deploying and starting Coze Studio for the first time, it may take a while to retrieve images and build local images. Please be patient. During deployment, you will see the following log information. If you see the message "Container coze-server Started," it means the Coze Studio service has started successfully.
|
||||
```Bash
|
||||
@ -77,6 +77,8 @@ Deployment steps:
|
||||
For common startup failure issues, **please refer to the [FAQ](https://github.com/coze-dev/coze-studio/wiki/9.-FAQ)**.
|
||||
4. After starting the service, you can open Coze Studio by accessing `http://localhost:8888/` through your browser.
|
||||
|
||||
> [!WARNING]
|
||||
> If you want to deploy Coze Studio in a public network environment, it is recommended to assess security risks before you begin, and take corresponding protection measures. Possible security risks include account registration functions, Python execution environments in workflow code nodes, Coze Server listening address configurations, SSRF (Server - Side Request Forgery), and some horizontal privilege escalations in APIs. For more details, refer to [Quickstart](https://github.com/coze-dev/coze-studio/wiki/2.-Quickstart#security-risks-in-public-networks).
|
||||
|
||||
## Developer Guide
|
||||
|
||||
@ -106,7 +108,7 @@ This project uses the Apache 2.0 license. For details, please refer to the [LICE
|
||||
## Community contributions
|
||||
We welcome community contributions. For contribution guidelines, please refer to [CONTRIBUTING](https://github.com/coze-dev/coze-studio/blob/main/CONTRIBUTING.md) and [Code of conduct](https://github.com/coze-dev/coze-studio/blob/main/CODE_OF_CONDUCT.md). We look forward to your contributions!
|
||||
## Security and privacy
|
||||
If you discover potential security issues in the project, or believe you may have found a security issue, please notify the ByteDance security team through our [security center](https://security.bytedance.com/src) or [vulnerability reporting email](sec@bytedance.com).
|
||||
If you discover potential security issues in the project, or believe you may have found a security issue, please notify the ByteDance security team through our [security center](https://security.bytedance.com/src) or [vulnerability reporting email](mailto:sec@bytedance.com).
|
||||
Please **do not** create public GitHub Issues.
|
||||
## Join Community
|
||||
|
||||
|
||||
@ -37,7 +37,6 @@ Coze Studio 的后端采用 Golang 开发,前端使用 React + TypeScript,
|
||||
| API 与 SDK | * 创建会话、发起对话等 OpenAPI <br> * 通过 Chat SDK 将智能体或应用集成到自己的应用 |
|
||||
## 快速开始
|
||||
了解如何获取并部署 Coze Studio 开源版,快速构建项目、体验 Coze Studio 开源版。
|
||||
> 详细步骤及部署要求可参考[快速开始](https://github.com/coze-dev/coze-studio/wiki/2.-快速开始)。
|
||||
|
||||
环境要求:
|
||||
|
||||
@ -63,9 +62,10 @@ Coze Studio 的后端采用 Golang 开发,前端使用 React + TypeScript,
|
||||
2. 在配置文件目录下,修改模版文件。
|
||||
1. 进入目录 `backend/conf/model`。打开复制后的文件`ark_doubao-seed-1.6.yaml`。
|
||||
2. 设置 `id`、`meta.conn_config.api_key`、`meta.conn_config.model` 字段,并保存文件。
|
||||
* **id**:Coze Studio 中的模型 ID,由开发者自行定义,必须是非 0 的整数,且全局唯一。模型上线后请勿修改模型 id 。
|
||||
* **meta.conn_config.api_key**:模型服务的 API Key,在本示例中为火山方舟的 API Key,获取方式可参考[获取火山方舟 API Key](https://www.volcengine.com/docs/82379/1541594)。
|
||||
* **meta.conn_config.model**:模型服务的 model ID,在本示例中为火山方舟 doubao-seed-1.6 模型接入点的 Endpoint ID,获取方式可参考[获取 Endpoint ID](https://www.volcengine.com/docs/82379/1099522)。
|
||||
* **id**:Coze Studio 中的模型 ID,由开发者自行定义,必须是非 0 的整数,且全局唯一。智能体或工作流根据模型 ID 来调用模型。对于已上线的模型,请勿修改模型 ID,否则可能导致模型调用失败。
|
||||
* **meta.conn_config.api_key**:模型服务的 API Key,在本示例中为火山方舟的 API Key,获取方式可参考[获取火山方舟 API Key](https://www.volcengine.com/docs/82379/1541594) 或[获取 Byteplus ModelArk API Key](https://docs.byteplus.com/en/docs/ModelArk/1361424?utm_source=github&utm_medium=readme&utm_campaign=coze_open_source)。
|
||||
* **meta.conn_config.model**:模型服务的 Model name,在本示例中为火山方舟的 Model ID 或 Endpoint ID,获取方式可参考 [获取火山方舟 Model ID](https://www.volcengine.com/docs/82379/1513689) / [获取火山方舟 Endpoint ID](https://www.volcengine.com/docs/82379/1099522),或者参考[获取 BytePlus ModelArk Model ID](https://docs.byteplus.com/en/docs/ModelArk/model_id?utm_source=github&utm_medium=readme&utm_campaign=coze_open_source) / [获取 BytePlus ModelArk Endpoint ID](https://docs.byteplus.com/en/docs/ModelArk/1099522?utm_source=github&utm_medium=readme&utm_campaign=coze_open_source)。
|
||||
> 中国境内用户可选用火山方舟(Volcengine Ark),非中国境内的用户则可用 BytePlus ModelArk。
|
||||
3. 部署并启动服务。
|
||||
首次部署并启动 Coze Studio 需要拉取镜像、构建本地镜像,可能耗时较久,请耐心等待。部署过程中,你会看到以下日志信息。如果看到提示 "Container coze-server Started",表示 Coze Studio 服务已成功启动。
|
||||
```Bash
|
||||
@ -78,6 +78,8 @@ Coze Studio 的后端采用 Golang 开发,前端使用 React + TypeScript,
|
||||
|
||||
4. 启动服务后,通过浏览器访问 `http://localhost:8888/` 即可打开 Coze Studio。
|
||||
|
||||
> [!WARNING]
|
||||
> 如果要将 Coze Studio 部署到公网环境,建议在部署前评估整体评估安全风险,例如账号注册功能、工作流代码节点 Python执行环境、Coze Server 监听地址配置、SSRF 和部分 API 水平越权的风险,并采取相应防护措施。详细信息可参考[快速开始](https://github.com/coze-dev/coze-studio/wiki/2.-%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B#%E5%85%AC%E7%BD%91%E5%AE%89%E5%85%A8%E9%A3%8E%E9%99%A9)。
|
||||
## 开发指南
|
||||
|
||||
* **项目配置**:
|
||||
@ -106,7 +108,7 @@ Coze Studio 的后端采用 Golang 开发,前端使用 React + TypeScript,
|
||||
## 社区贡献
|
||||
我们欢迎社区贡献,贡献指南参见 [CONTRIBUTING](https://github.com/coze-dev/coze-studio/blob/main/CONTRIBUTING.md) 和 [Code of conduct](https://github.com/coze-dev/coze-studio/blob/main/CODE_OF_CONDUCT.md),期待您的贡献!
|
||||
## 安全与隐私
|
||||
如果你在该项目中发现潜在的安全问题,或你认为可能发现了安全问题,请通过我们的[安全中心](https://security.bytedance.com/src) 或[漏洞报告邮箱](sec@bytedance.com)通知字节跳动安全团队。
|
||||
如果你在该项目中发现潜在的安全问题,或你认为可能发现了安全问题,请通过我们的[安全中心](https://security.bytedance.com/src) 或[漏洞报告邮箱](mailto:sec@bytedance.com)通知字节跳动安全团队。
|
||||
请**不要**创建公开的 GitHub Issue。
|
||||
## 加入社区
|
||||
|
||||
|
||||
@ -33,9 +33,8 @@ RUN apk add --no-cache --virtual .python-build-deps build-base py3-pip git && \
|
||||
# Activate venv and install packages
|
||||
. /app/.venv/bin/activate && \
|
||||
# If you want to use other third-party libraries, you can install them here.
|
||||
pip install git+https://gitcode.com/gh_mirrors/re/requests-async.git@master && \
|
||||
pip install urllib3==1.26.16 && \
|
||||
pip install --no-cache-dir pillow==11.2.1 pdfplumber==0.11.7 python-docx==1.2.0 numpy==2.3.1 && \
|
||||
pip install --no-cache-dir h11==0.16.0 httpx==0.28.1 pillow==11.2.1 pdfplumber==0.11.7 python-docx==1.2.0 numpy==2.3.1 && \
|
||||
# Deactivate (optional, as RUN is a new shell)
|
||||
# deactivate && \
|
||||
# Remove build dependencies
|
||||
@ -52,7 +51,7 @@ COPY backend/infra/impl/coderunner/script/sandbox.py /app/sandbox.py
|
||||
|
||||
|
||||
# Copy static resources
|
||||
COPY backend/static /app/resources/static/
|
||||
# COPY backend/static /app/resources/static/
|
||||
COPY backend/conf /app/resources/conf/
|
||||
COPY docker/.env.example /app/.env
|
||||
# COPY docker/.env.ve /app/.env
|
||||
|
||||
@ -20,13 +20,17 @@ package coze
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/application/plugin"
|
||||
"github.com/coze-dev/coze-studio/backend/application/singleagent"
|
||||
"github.com/coze-dev/coze-studio/backend/application/upload"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/plugin/conf"
|
||||
|
||||
"github.com/cloudwego/hertz/pkg/app"
|
||||
"github.com/cloudwego/hertz/pkg/protocol/consts"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/application/plugin"
|
||||
|
||||
bot_open_api "github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/bot_open_api"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/app/bot_open_api"
|
||||
)
|
||||
|
||||
// OauthAuthorizationCode .
|
||||
@ -41,7 +45,7 @@ func OauthAuthorizationCode(ctx context.Context, c *app.RequestContext) {
|
||||
}
|
||||
|
||||
if req.Code == "" {
|
||||
invalidParamRequestResponse(c, "code is required")
|
||||
invalidParamRequestResponse(c, "authorization failed, code is required")
|
||||
return
|
||||
}
|
||||
if req.State == "" {
|
||||
@ -49,11 +53,55 @@ func OauthAuthorizationCode(ctx context.Context, c *app.RequestContext) {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := plugin.PluginApplicationSVC.OauthAuthorizationCode(ctx, &req)
|
||||
_, err = plugin.PluginApplicationSVC.OauthAuthorizationCode(ctx, &req)
|
||||
if err != nil {
|
||||
internalServerErrorResponse(ctx, c, err)
|
||||
return
|
||||
}
|
||||
|
||||
redirectURL := fmt.Sprintf("%s/information/auth/success", conf.GetServerHost())
|
||||
c.Redirect(consts.StatusFound, []byte(redirectURL))
|
||||
c.Abort()
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UploadFileOpen .
|
||||
// @router /v1/files/upload [POST]
|
||||
func UploadFileOpen(ctx context.Context, c *app.RequestContext) {
|
||||
var err error
|
||||
var req bot_open_api.UploadFileOpenRequest
|
||||
err = c.BindAndValidate(&req)
|
||||
if err != nil {
|
||||
c.String(consts.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
resp := new(bot_open_api.UploadFileOpenResponse)
|
||||
resp, err = upload.SVC.UploadFileOpen(ctx, &req)
|
||||
if err != nil {
|
||||
internalServerErrorResponse(ctx, c, err)
|
||||
return
|
||||
}
|
||||
c.JSON(consts.StatusOK, resp)
|
||||
}
|
||||
|
||||
// GetBotOnlineInfo .
|
||||
// @router /v1/bot/get_online_info [GET]
|
||||
func GetBotOnlineInfo(ctx context.Context, c *app.RequestContext) {
|
||||
var err error
|
||||
var req bot_open_api.GetBotOnlineInfoReq
|
||||
err = c.BindAndValidate(&req)
|
||||
if err != nil {
|
||||
c.String(consts.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := singleagent.SingleAgentSVC.GetAgentOnlineInfo(ctx, &req)
|
||||
|
||||
if err != nil {
|
||||
internalServerErrorResponse(ctx, c, err)
|
||||
return
|
||||
}
|
||||
c.JSON(consts.StatusOK, resp)
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ import (
|
||||
|
||||
func TestClearConversationCtx(t *testing.T) {
|
||||
h := server.Default()
|
||||
_, err := application.Init(context.Background())
|
||||
err := application.Init(context.Background())
|
||||
|
||||
t.Logf("application init err: %v", err)
|
||||
h.POST("/api/conversation/create_section", ClearConversationCtx)
|
||||
@ -55,7 +55,7 @@ func TestClearConversationCtx(t *testing.T) {
|
||||
|
||||
func TestClearConversationHistory(t *testing.T) {
|
||||
h := server.Default()
|
||||
_, err := application.Init(context.Background())
|
||||
err := application.Init(context.Background())
|
||||
t.Logf("application init err: %v", err)
|
||||
h.POST("/api/conversation/clear_message", ClearConversationHistory)
|
||||
req := &conversation.ClearConversationHistoryRequest{
|
||||
|
||||
@ -24,8 +24,8 @@ import (
|
||||
"github.com/cloudwego/hertz/pkg/app"
|
||||
"github.com/cloudwego/hertz/pkg/protocol/consts"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/knowledge/document"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/table"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/data/database/table"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/data/knowledge"
|
||||
"github.com/coze-dev/coze-studio/backend/application/memory"
|
||||
"github.com/coze-dev/coze-studio/backend/application/singleagent"
|
||||
)
|
||||
@ -341,7 +341,7 @@ func GetDatabaseTableSchema(ctx context.Context, c *app.RequestContext) {
|
||||
return
|
||||
}
|
||||
|
||||
var resp *document.GetTableSchemaInfoResponse
|
||||
var resp *knowledge.GetTableSchemaInfoResponse
|
||||
resp, err = memory.DatabaseApplicationSVC.GetDatabaseTableSchema(ctx, &req)
|
||||
if err != nil {
|
||||
internalServerErrorResponse(ctx, c, err)
|
||||
|
||||
@ -30,7 +30,7 @@ import (
|
||||
"github.com/cloudwego/hertz/pkg/app"
|
||||
"github.com/cloudwego/hertz/pkg/protocol/consts"
|
||||
|
||||
developer_api "github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/developer_api"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/app/developer_api"
|
||||
"github.com/coze-dev/coze-studio/backend/application/base/ctxutil"
|
||||
"github.com/coze-dev/coze-studio/backend/application/modelmgr"
|
||||
"github.com/coze-dev/coze-studio/backend/application/singleagent"
|
||||
|
||||
@ -25,11 +25,11 @@ import (
|
||||
"github.com/cloudwego/hertz/pkg/app"
|
||||
"github.com/cloudwego/hertz/pkg/protocol/consts"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/intelligence"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/intelligence/common"
|
||||
project "github.com/coze-dev/coze-studio/backend/api/model/project"
|
||||
publish "github.com/coze-dev/coze-studio/backend/api/model/publish"
|
||||
task "github.com/coze-dev/coze-studio/backend/api/model/task"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/app/intelligence"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/app/intelligence/common"
|
||||
project "github.com/coze-dev/coze-studio/backend/api/model/app/intelligence/project"
|
||||
publish "github.com/coze-dev/coze-studio/backend/api/model/app/intelligence/publish"
|
||||
task "github.com/coze-dev/coze-studio/backend/api/model/app/intelligence/task"
|
||||
appApplication "github.com/coze-dev/coze-studio/backend/application/app"
|
||||
"github.com/coze-dev/coze-studio/backend/application/search"
|
||||
)
|
||||
|
||||
@ -24,8 +24,10 @@ import (
|
||||
"github.com/cloudwego/hertz/pkg/app"
|
||||
"github.com/cloudwego/hertz/pkg/protocol/consts"
|
||||
|
||||
dataset "github.com/coze-dev/coze-studio/backend/api/model/flow/dataengine/dataset"
|
||||
dataset "github.com/coze-dev/coze-studio/backend/api/model/data/knowledge"
|
||||
"github.com/coze-dev/coze-studio/backend/application/knowledge"
|
||||
application "github.com/coze-dev/coze-studio/backend/application/knowledge"
|
||||
"github.com/coze-dev/coze-studio/backend/application/memory"
|
||||
"github.com/coze-dev/coze-studio/backend/application/upload"
|
||||
)
|
||||
|
||||
@ -526,3 +528,48 @@ func ExtractPhotoCaption(ctx context.Context, c *app.RequestContext) {
|
||||
}
|
||||
c.JSON(consts.StatusOK, resp)
|
||||
}
|
||||
|
||||
// GetDocumentTableInfo .
|
||||
// @router /api/memory/doc_table_info [GET]
|
||||
func GetDocumentTableInfo(ctx context.Context, c *app.RequestContext) {
|
||||
var err error
|
||||
var req dataset.GetDocumentTableInfoRequest
|
||||
err = c.BindAndValidate(&req)
|
||||
if err != nil {
|
||||
c.String(consts.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
resp := new(dataset.GetDocumentTableInfoResponse)
|
||||
resp, err = knowledge.KnowledgeSVC.GetDocumentTableInfo(ctx, &req)
|
||||
if err != nil {
|
||||
internalServerErrorResponse(ctx, c, err)
|
||||
return
|
||||
}
|
||||
c.JSON(consts.StatusOK, resp)
|
||||
}
|
||||
|
||||
// GetModeConfig .
|
||||
// @router /api/memory/table_mode_config [GET]
|
||||
func GetModeConfig(ctx context.Context, c *app.RequestContext) {
|
||||
var err error
|
||||
var req dataset.GetModeConfigRequest
|
||||
err = c.BindAndValidate(&req)
|
||||
if err != nil {
|
||||
c.String(consts.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
if req.BotID == 0 {
|
||||
invalidParamRequestResponse(c, "bot_id is zero")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := memory.DatabaseApplicationSVC.GetModeConfig(ctx, &req)
|
||||
if err != nil {
|
||||
internalServerErrorResponse(ctx, c, err)
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(consts.StatusOK, resp)
|
||||
}
|
||||
|
||||
@ -24,12 +24,9 @@ import (
|
||||
"github.com/cloudwego/hertz/pkg/app"
|
||||
"github.com/cloudwego/hertz/pkg/protocol/consts"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/knowledge/document"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/kvmemory"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/project_memory"
|
||||
table "github.com/coze-dev/coze-studio/backend/api/model/table"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/data/variable/kvmemory"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/data/variable/project_memory"
|
||||
appApplication "github.com/coze-dev/coze-studio/backend/application/app"
|
||||
"github.com/coze-dev/coze-studio/backend/application/knowledge"
|
||||
"github.com/coze-dev/coze-studio/backend/application/memory"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/lang/conv"
|
||||
)
|
||||
@ -230,48 +227,3 @@ func GetPlayGroundMemory(ctx context.Context, c *app.RequestContext) {
|
||||
|
||||
c.JSON(consts.StatusOK, resp)
|
||||
}
|
||||
|
||||
// GetDocumentTableInfo .
|
||||
// @router /api/memory/doc_table_info [GET]
|
||||
func GetDocumentTableInfo(ctx context.Context, c *app.RequestContext) {
|
||||
var err error
|
||||
var req document.GetDocumentTableInfoRequest
|
||||
err = c.BindAndValidate(&req)
|
||||
if err != nil {
|
||||
c.String(consts.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
resp := new(document.GetDocumentTableInfoResponse)
|
||||
resp, err = knowledge.KnowledgeSVC.GetDocumentTableInfo(ctx, &req)
|
||||
if err != nil {
|
||||
internalServerErrorResponse(ctx, c, err)
|
||||
return
|
||||
}
|
||||
c.JSON(consts.StatusOK, resp)
|
||||
}
|
||||
|
||||
// GetModeConfig .
|
||||
// @router /api/memory/table_mode_config [GET]
|
||||
func GetModeConfig(ctx context.Context, c *app.RequestContext) {
|
||||
var err error
|
||||
var req table.GetModeConfigRequest
|
||||
err = c.BindAndValidate(&req)
|
||||
if err != nil {
|
||||
c.String(consts.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
if req.BotID == 0 {
|
||||
invalidParamRequestResponse(c, "bot_id is zero")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := memory.DatabaseApplicationSVC.GetModeConfig(ctx, &req)
|
||||
if err != nil {
|
||||
internalServerErrorResponse(ctx, c, err)
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(consts.StatusOK, resp)
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ import (
|
||||
|
||||
func TestGetMessageList(t *testing.T) {
|
||||
h := server.Default()
|
||||
_, err := application.Init(context.Background())
|
||||
err := application.Init(context.Background())
|
||||
|
||||
t.Logf("application init err: %v", err)
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ import (
|
||||
"github.com/cloudwego/hertz/pkg/app"
|
||||
"github.com/cloudwego/hertz/pkg/protocol/consts"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/playground"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/playground"
|
||||
appApplication "github.com/coze-dev/coze-studio/backend/application/app"
|
||||
"github.com/coze-dev/coze-studio/backend/application/prompt"
|
||||
"github.com/coze-dev/coze-studio/backend/application/shortcutcmd"
|
||||
@ -371,43 +371,3 @@ func GetFileUrls(ctx context.Context, c *app.RequestContext) {
|
||||
|
||||
c.JSON(consts.StatusOK, resp)
|
||||
}
|
||||
|
||||
// UploadFileOpen .
|
||||
// @router /v1/files/upload [POST]
|
||||
func UploadFileOpen(ctx context.Context, c *app.RequestContext) {
|
||||
var err error
|
||||
var req playground.UploadFileOpenRequest
|
||||
err = c.BindAndValidate(&req)
|
||||
if err != nil {
|
||||
c.String(consts.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
resp := new(playground.UploadFileOpenResponse)
|
||||
resp, err = upload.SVC.UploadFileOpen(ctx, &req)
|
||||
if err != nil {
|
||||
internalServerErrorResponse(ctx, c, err)
|
||||
return
|
||||
}
|
||||
c.JSON(consts.StatusOK, resp)
|
||||
}
|
||||
|
||||
// GetBotOnlineInfo .
|
||||
// @router /v1/bot/get_online_info [GET]
|
||||
func GetBotOnlineInfo(ctx context.Context, c *app.RequestContext) {
|
||||
var err error
|
||||
var req playground.GetBotOnlineInfoReq
|
||||
err = c.BindAndValidate(&req)
|
||||
if err != nil {
|
||||
c.String(consts.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := singleagent.SingleAgentSVC.GetAgentOnlineInfo(ctx, &req)
|
||||
|
||||
if err != nil {
|
||||
internalServerErrorResponse(ctx, c, err)
|
||||
return
|
||||
}
|
||||
c.JSON(consts.StatusOK, resp)
|
||||
}
|
||||
|
||||
@ -25,8 +25,8 @@ import (
|
||||
"github.com/cloudwego/hertz/pkg/app"
|
||||
"github.com/cloudwego/hertz/pkg/protocol/consts"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/plugin_develop"
|
||||
common "github.com/coze-dev/coze-studio/backend/api/model/plugin_develop_common"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/plugin_develop"
|
||||
common "github.com/coze-dev/coze-studio/backend/api/model/plugin_develop/common"
|
||||
"github.com/coze-dev/coze-studio/backend/application/plugin"
|
||||
appworkflow "github.com/coze-dev/coze-studio/backend/application/workflow"
|
||||
)
|
||||
|
||||
@ -22,18 +22,18 @@ import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/workflow"
|
||||
product_public_api "github.com/coze-dev/coze-studio/backend/api/model/marketplace/product_public_api"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/workflow"
|
||||
appworkflow "github.com/coze-dev/coze-studio/backend/application/workflow"
|
||||
|
||||
"github.com/cloudwego/hertz/pkg/app"
|
||||
"github.com/cloudwego/hertz/pkg/protocol/consts"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/developer_api"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/app/developer_api"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/flow/marketplace/product_common"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/flow/marketplace/product_public_api"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/bot_common"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/playground"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/app/bot_common"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/marketplace/product_common"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/playground"
|
||||
appApplication "github.com/coze-dev/coze-studio/backend/application/app"
|
||||
"github.com/coze-dev/coze-studio/backend/application/modelmgr"
|
||||
"github.com/coze-dev/coze-studio/backend/application/plugin"
|
||||
|
||||
@ -29,7 +29,7 @@ import (
|
||||
"github.com/cloudwego/hertz/pkg/protocol/consts"
|
||||
"github.com/cloudwego/hertz/pkg/protocol/sse"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/workflow"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/workflow"
|
||||
appworkflow "github.com/coze-dev/coze-studio/backend/application/workflow"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/entity/vo"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/lang/ptr"
|
||||
|
||||
@ -31,7 +31,9 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/alicebob/miniredis/v2"
|
||||
|
||||
"github.com/bytedance/mockey"
|
||||
"github.com/cloudwego/eino/callbacks"
|
||||
model2 "github.com/cloudwego/eino/components/model"
|
||||
"github.com/cloudwego/eino/schema"
|
||||
"github.com/cloudwego/hertz/pkg/app"
|
||||
@ -40,51 +42,53 @@ import (
|
||||
"github.com/cloudwego/hertz/pkg/common/ut"
|
||||
"github.com/cloudwego/hertz/pkg/protocol"
|
||||
"github.com/cloudwego/hertz/pkg/protocol/sse"
|
||||
"github.com/redis/go-redis/v9"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/mock/gomock"
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/crossdomain/knowledge"
|
||||
modelknowledge "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/knowledge"
|
||||
model "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/modelmgr"
|
||||
plugin2 "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/plugin"
|
||||
pluginmodel "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/plugin"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/playground"
|
||||
pluginAPI "github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/plugin_develop"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/workflow"
|
||||
workflowModel "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/workflow"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/playground"
|
||||
pluginAPI "github.com/coze-dev/coze-studio/backend/api/model/plugin_develop"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/workflow"
|
||||
"github.com/coze-dev/coze-studio/backend/application/base/ctxutil"
|
||||
appknowledge "github.com/coze-dev/coze-studio/backend/application/knowledge"
|
||||
appmemory "github.com/coze-dev/coze-studio/backend/application/memory"
|
||||
appplugin "github.com/coze-dev/coze-studio/backend/application/plugin"
|
||||
"github.com/coze-dev/coze-studio/backend/application/user"
|
||||
appworkflow "github.com/coze-dev/coze-studio/backend/application/workflow"
|
||||
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/crossuser"
|
||||
plugin3 "github.com/coze-dev/coze-studio/backend/crossdomain/workflow/plugin"
|
||||
crossdatabase "github.com/coze-dev/coze-studio/backend/crossdomain/contract/database"
|
||||
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/database/databasemock"
|
||||
crossknowledge "github.com/coze-dev/coze-studio/backend/crossdomain/contract/knowledge"
|
||||
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/knowledge/knowledgemock"
|
||||
crossmodelmgr "github.com/coze-dev/coze-studio/backend/crossdomain/contract/modelmgr"
|
||||
mockmodel "github.com/coze-dev/coze-studio/backend/crossdomain/contract/modelmgr/modelmock"
|
||||
crossplugin "github.com/coze-dev/coze-studio/backend/crossdomain/contract/plugin"
|
||||
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/plugin/pluginmock"
|
||||
crossuser "github.com/coze-dev/coze-studio/backend/crossdomain/contract/user"
|
||||
"github.com/coze-dev/coze-studio/backend/crossdomain/impl/code"
|
||||
pluginImpl "github.com/coze-dev/coze-studio/backend/crossdomain/impl/plugin"
|
||||
entity4 "github.com/coze-dev/coze-studio/backend/domain/memory/database/entity"
|
||||
entity2 "github.com/coze-dev/coze-studio/backend/domain/openauth/openapiauth/entity"
|
||||
entity3 "github.com/coze-dev/coze-studio/backend/domain/plugin/entity"
|
||||
entity5 "github.com/coze-dev/coze-studio/backend/domain/plugin/entity"
|
||||
search "github.com/coze-dev/coze-studio/backend/domain/search/entity"
|
||||
userentity "github.com/coze-dev/coze-studio/backend/domain/user/entity"
|
||||
workflow2 "github.com/coze-dev/coze-studio/backend/domain/workflow"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/crossdomain/code"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/crossdomain/database"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/crossdomain/database/databasemock"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/crossdomain/knowledge"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/crossdomain/knowledge/knowledgemock"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/crossdomain/model"
|
||||
mockmodel "github.com/coze-dev/coze-studio/backend/domain/workflow/crossdomain/model/modelmock"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/crossdomain/plugin"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/crossdomain/plugin/pluginmock"
|
||||
crosssearch "github.com/coze-dev/coze-studio/backend/domain/workflow/crossdomain/search"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/crossdomain/search/searchmock"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/crossdomain/variable"
|
||||
mockvar "github.com/coze-dev/coze-studio/backend/domain/workflow/crossdomain/variable/varmock"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/entity"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/entity/vo"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/service"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/variable"
|
||||
mockvar "github.com/coze-dev/coze-studio/backend/domain/workflow/variable/varmock"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/coderunner"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/modelmgr"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/cache/redis"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/checkpoint"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/coderunner/direct"
|
||||
mockCrossUser "github.com/coze-dev/coze-studio/backend/internal/mock/crossdomain/crossuser"
|
||||
@ -102,23 +106,30 @@ import (
|
||||
"github.com/coze-dev/coze-studio/backend/types/errno"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
callbacks.AppendGlobalHandlers(service.GetTokenCallbackHandler())
|
||||
service.RegisterAllNodeAdaptors()
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
type wfTestRunner struct {
|
||||
t *testing.T
|
||||
h *server.Hertz
|
||||
ctrl *gomock.Controller
|
||||
idGen *mock.MockIDGenerator
|
||||
search *searchmock.MockNotifier
|
||||
appVarS *mockvar.MockStore
|
||||
userVarS *mockvar.MockStore
|
||||
varGetter *mockvar.MockVariablesMetaGetter
|
||||
modelManage *mockmodel.MockManager
|
||||
plugin *mockPlugin.MockPluginService
|
||||
tos *storageMock.MockStorage
|
||||
knowledge *knowledgemock.MockKnowledgeOperator
|
||||
database *databasemock.MockDatabaseOperator
|
||||
pluginSrv *pluginmock.MockService
|
||||
ctx context.Context
|
||||
closeFn func()
|
||||
t *testing.T
|
||||
h *server.Hertz
|
||||
ctrl *gomock.Controller
|
||||
idGen *mock.MockIDGenerator
|
||||
appVarS *mockvar.MockStore
|
||||
userVarS *mockvar.MockStore
|
||||
varGetter *mockvar.MockVariablesMetaGetter
|
||||
modelManage *mockmodel.MockManager
|
||||
plugin *mockPlugin.MockPluginService
|
||||
tos *storageMock.MockStorage
|
||||
knowledge *knowledgemock.MockKnowledge
|
||||
database *databasemock.MockDatabase
|
||||
pluginSrv *pluginmock.MockPluginService
|
||||
internalModel *testutil.UTChatModel
|
||||
publishPatcher *mockey.Mocker
|
||||
ctx context.Context
|
||||
closeFn func()
|
||||
}
|
||||
|
||||
var req2URL = map[reflect.Type]string{
|
||||
@ -231,21 +242,18 @@ func newWfTestRunner(t *testing.T) *wfTestRunner {
|
||||
t.Fatalf("Failed to start miniredis: %v", err)
|
||||
}
|
||||
|
||||
redisClient := redis.NewClient(&redis.Options{
|
||||
Addr: s.Addr(),
|
||||
})
|
||||
redisClient := redis.NewWithAddrAndPassword(s.Addr(), "")
|
||||
|
||||
cpStore := checkpoint.NewRedisStore(redisClient)
|
||||
|
||||
utChatModel := &testutil.UTChatModel{}
|
||||
|
||||
mockTos := storageMock.NewMockStorage(ctrl)
|
||||
mockTos.EXPECT().GetObjectUrl(gomock.Any(), gomock.Any(), gomock.Any()).Return("", nil).AnyTimes()
|
||||
workflowRepo := service.NewWorkflowRepository(mockIDGen, db, redisClient, mockTos, cpStore, nil)
|
||||
workflowRepo := service.NewWorkflowRepository(mockIDGen, db, redisClient, mockTos, cpStore, utChatModel, nil)
|
||||
mockey.Mock(appworkflow.GetWorkflowDomainSVC).Return(service.NewWorkflowService(workflowRepo)).Build()
|
||||
mockey.Mock(workflow2.GetRepository).Return(workflowRepo).Build()
|
||||
|
||||
mockSearchNotify := searchmock.NewMockNotifier(ctrl)
|
||||
mockey.Mock(crosssearch.GetNotifier).Return(mockSearchNotify).Build()
|
||||
mockSearchNotify.EXPECT().PublishWorkflowResource(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
|
||||
publishPatcher := mockey.Mock(appworkflow.PublishWorkflowResource).Return(nil).Build()
|
||||
|
||||
mockCU := mockCrossUser.NewMockUser(ctrl)
|
||||
mockCU.EXPECT().GetUserSpaceList(gomock.Any(), gomock.Any()).Return([]*crossuser.EntitySpace{
|
||||
@ -268,12 +276,12 @@ func newWfTestRunner(t *testing.T) *wfTestRunner {
|
||||
|
||||
mPlugin := mockPlugin.NewMockPluginService(ctrl)
|
||||
|
||||
mockKwOperator := knowledgemock.NewMockKnowledgeOperator(ctrl)
|
||||
knowledge.SetKnowledgeOperator(mockKwOperator)
|
||||
mockKwOperator := knowledgemock.NewMockKnowledge(ctrl)
|
||||
crossknowledge.SetDefaultSVC(mockKwOperator)
|
||||
|
||||
mockModelManage := mockmodel.NewMockManager(ctrl)
|
||||
mockModelManage.EXPECT().GetModel(gomock.Any(), gomock.Any()).Return(nil, nil, nil).AnyTimes()
|
||||
m3 := mockey.Mock(model.GetManager).Return(mockModelManage).Build()
|
||||
m3 := mockey.Mock(crossmodelmgr.DefaultSVC).Return(mockModelManage).Build()
|
||||
|
||||
m := mockey.Mock(crossuser.DefaultSVC).Return(mockCU).Build()
|
||||
m1 := mockey.Mock(ctxutil.GetApiAuthFromCtx).Return(&entity2.ApiKey{
|
||||
@ -283,17 +291,18 @@ func newWfTestRunner(t *testing.T) *wfTestRunner {
|
||||
m4 := mockey.Mock(ctxutil.MustGetUIDFromCtx).Return(int64(1)).Build()
|
||||
m5 := mockey.Mock(ctxutil.GetUIDFromCtx).Return(ptr.Of(int64(1))).Build()
|
||||
|
||||
mockDatabaseOperator := databasemock.NewMockDatabaseOperator(ctrl)
|
||||
database.SetDatabaseOperator(mockDatabaseOperator)
|
||||
mockDatabaseOperator := databasemock.NewMockDatabase(ctrl)
|
||||
crossdatabase.SetDefaultSVC(mockDatabaseOperator)
|
||||
|
||||
mockPluginSrv := pluginmock.NewMockService(ctrl)
|
||||
plugin.SetPluginService(mockPluginSrv)
|
||||
mockPluginSrv := pluginmock.NewMockPluginService(ctrl)
|
||||
crossplugin.SetDefaultSVC(mockPluginSrv)
|
||||
|
||||
mockey.Mock((*user.UserApplicationService).MGetUserBasicInfo).Return(&playground.MGetUserBasicInfoResponse{
|
||||
UserBasicInfoMap: make(map[string]*playground.UserBasicInfo),
|
||||
}, nil).Build()
|
||||
|
||||
f := func() {
|
||||
publishPatcher.UnPatch()
|
||||
m.UnPatch()
|
||||
m1.UnPatch()
|
||||
m2.UnPatch()
|
||||
@ -306,22 +315,23 @@ func newWfTestRunner(t *testing.T) *wfTestRunner {
|
||||
}
|
||||
|
||||
return &wfTestRunner{
|
||||
t: t,
|
||||
h: h,
|
||||
ctrl: ctrl,
|
||||
idGen: mockIDGen,
|
||||
search: mockSearchNotify,
|
||||
appVarS: mockGlobalAppVarStore,
|
||||
userVarS: mockGlobalUserVarStore,
|
||||
varGetter: mockVarGetter,
|
||||
modelManage: mockModelManage,
|
||||
plugin: mPlugin,
|
||||
tos: mockTos,
|
||||
knowledge: mockKwOperator,
|
||||
database: mockDatabaseOperator,
|
||||
ctx: context.Background(),
|
||||
closeFn: f,
|
||||
pluginSrv: mockPluginSrv,
|
||||
t: t,
|
||||
h: h,
|
||||
ctrl: ctrl,
|
||||
idGen: mockIDGen,
|
||||
appVarS: mockGlobalAppVarStore,
|
||||
userVarS: mockGlobalUserVarStore,
|
||||
varGetter: mockVarGetter,
|
||||
modelManage: mockModelManage,
|
||||
plugin: mPlugin,
|
||||
tos: mockTos,
|
||||
knowledge: mockKwOperator,
|
||||
database: mockDatabaseOperator,
|
||||
internalModel: utChatModel,
|
||||
ctx: context.Background(),
|
||||
closeFn: f,
|
||||
pluginSrv: mockPluginSrv,
|
||||
publishPatcher: publishPatcher,
|
||||
}
|
||||
}
|
||||
|
||||
@ -1104,7 +1114,8 @@ func TestValidateTree(t *testing.T) {
|
||||
assert.Equal(t, i.Message, `node "代码_1" not connected`)
|
||||
}
|
||||
if i.NodeError.NodeID == "160892" {
|
||||
assert.Contains(t, i.Message, `node "意图识别"'s port "branch_1" not connected`, `node "意图识别"'s port "default" not connected;`)
|
||||
assert.Contains(t, i.Message, `node "意图识别"'s port "branch_1" not connected`)
|
||||
assert.Contains(t, i.Message, `node "意图识别"'s port "default" not connected`)
|
||||
}
|
||||
|
||||
}
|
||||
@ -1151,7 +1162,8 @@ func TestValidateTree(t *testing.T) {
|
||||
assert.Equal(t, i.Message, `node "代码_1" not connected`)
|
||||
}
|
||||
if i.NodeError.NodeID == "160892" {
|
||||
assert.Contains(t, i.Message, `node "意图识别"'s port "branch_1" not connected`, `node "意图识别"'s port "default" not connected;`)
|
||||
assert.Contains(t, i.Message, `node "意图识别"'s port "branch_1" not connected`)
|
||||
assert.Contains(t, i.Message, `node "意图识别"'s port "default" not connected`)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2242,24 +2254,22 @@ func TestNodeWithBatchEnabled(t *testing.T) {
|
||||
})
|
||||
e := r.getProcess(id, exeID)
|
||||
e.assertSuccess()
|
||||
assert.Equal(t, map[string]any{
|
||||
outputMap := mustUnmarshalToMap(t, e.output)
|
||||
assert.Contains(t, outputMap["output"], map[string]any{
|
||||
"output": []any{
|
||||
map[string]any{
|
||||
"output": []any{
|
||||
"answer",
|
||||
"for index 0",
|
||||
},
|
||||
"input": "answer。for index 0",
|
||||
},
|
||||
map[string]any{
|
||||
"output": []any{
|
||||
"answer",
|
||||
"for index 1",
|
||||
},
|
||||
"input": "answer,for index 1",
|
||||
},
|
||||
"answer",
|
||||
"for index 0",
|
||||
},
|
||||
}, mustUnmarshalToMap(t, e.output))
|
||||
"input": "answer。for index 0",
|
||||
})
|
||||
assert.Contains(t, outputMap["output"], map[string]any{
|
||||
"output": []any{
|
||||
"answer",
|
||||
"for index 1",
|
||||
},
|
||||
"input": "answer,for index 1",
|
||||
})
|
||||
assert.Equal(t, 2, len(outputMap["output"].([]any)))
|
||||
e.tokenEqual(10, 12)
|
||||
|
||||
// verify this workflow has previously succeeded a test run
|
||||
@ -2863,9 +2873,8 @@ func TestLLMWithSkills(t *testing.T) {
|
||||
{ID: int64(7509353598782816256), Operation: operation},
|
||||
}, nil).AnyTimes()
|
||||
|
||||
pluginSrv := plugin3.NewPluginService(r.plugin, r.tos)
|
||||
|
||||
plugin.SetPluginService(pluginSrv)
|
||||
pluginSrv := pluginImpl.InitDomainService(r.plugin, r.tos)
|
||||
crossplugin.SetDefaultSVC(pluginSrv)
|
||||
|
||||
t.Run("llm with plugin tool", func(t *testing.T) {
|
||||
id := r.load("llm_node_with_skills/llm_node_with_plugin_tool.json")
|
||||
@ -2944,41 +2953,41 @@ func TestLLMWithSkills(t *testing.T) {
|
||||
r := newWfTestRunner(t)
|
||||
defer r.closeFn()
|
||||
|
||||
utChatModel := &testutil.UTChatModel{
|
||||
InvokeResultProvider: func(index int, in []*schema.Message) (*schema.Message, error) {
|
||||
if index == 0 {
|
||||
assert.Equal(t, 1, len(in))
|
||||
assert.Contains(t, in[0].Content, "7512369185624686592", "你是一个知识库意图识别AI Agent", "北京有哪些著名的景点")
|
||||
return &schema.Message{
|
||||
Role: schema.Assistant,
|
||||
Content: "7512369185624686592",
|
||||
ResponseMeta: &schema.ResponseMeta{
|
||||
Usage: &schema.TokenUsage{
|
||||
PromptTokens: 10,
|
||||
CompletionTokens: 11,
|
||||
TotalTokens: 21,
|
||||
},
|
||||
utChatModel := r.internalModel
|
||||
utChatModel.InvokeResultProvider = func(index int, in []*schema.Message) (*schema.Message, error) {
|
||||
if index == 0 {
|
||||
assert.Equal(t, 1, len(in))
|
||||
assert.Contains(t, in[0].Content, "7512369185624686592", "你是一个知识库意图识别AI Agent", "北京有哪些著名的景点")
|
||||
return &schema.Message{
|
||||
Role: schema.Assistant,
|
||||
Content: "7512369185624686592",
|
||||
ResponseMeta: &schema.ResponseMeta{
|
||||
Usage: &schema.TokenUsage{
|
||||
PromptTokens: 10,
|
||||
CompletionTokens: 11,
|
||||
TotalTokens: 21,
|
||||
},
|
||||
}, nil
|
||||
},
|
||||
}, nil
|
||||
|
||||
} else if index == 1 {
|
||||
assert.Equal(t, 2, len(in))
|
||||
for _, message := range in {
|
||||
if message.Role == schema.System {
|
||||
assert.Equal(t, "你是一个旅游推荐专家,通过用户提出的问题,推荐用户具体城市的旅游景点", message.Content)
|
||||
}
|
||||
if message.Role == schema.User {
|
||||
assert.Contains(t, message.Content, "天安门广场 :中国政治文化中心,见证了近现代重大历史事件", "八达岭长城 :明代长城的精华段,被誉为“不到长城非好汉")
|
||||
}
|
||||
} else if index == 1 {
|
||||
assert.Equal(t, 2, len(in))
|
||||
for _, message := range in {
|
||||
if message.Role == schema.System {
|
||||
assert.Equal(t, "你是一个旅游推荐专家,通过用户提出的问题,推荐用户具体城市的旅游景点", message.Content)
|
||||
}
|
||||
if message.Role == schema.User {
|
||||
assert.Contains(t, message.Content, "天安门广场 :中国政治文化中心,见证了近现代重大历史事件", "八达岭长城 :明代长城的精华段,被誉为“不到长城非好汉")
|
||||
}
|
||||
return &schema.Message{
|
||||
Role: schema.Assistant,
|
||||
Content: `八达岭长城 :明代长城的精华段,被誉为“不到长城非好汉`,
|
||||
}, nil
|
||||
}
|
||||
return nil, fmt.Errorf("unexpected index: %d", index)
|
||||
},
|
||||
return &schema.Message{
|
||||
Role: schema.Assistant,
|
||||
Content: `八达岭长城 :明代长城的精华段,被誉为“不到长城非好汉`,
|
||||
}, nil
|
||||
}
|
||||
return nil, fmt.Errorf("unexpected index: %d", index)
|
||||
}
|
||||
|
||||
r.modelManage.EXPECT().GetModel(gomock.Any(), gomock.Any()).Return(utChatModel, nil, nil).AnyTimes()
|
||||
|
||||
r.knowledge.EXPECT().ListKnowledgeDetail(gomock.Any(), gomock.Any()).Return(&knowledge.ListKnowledgeDetailResponse{
|
||||
@ -2987,22 +2996,22 @@ func TestLLMWithSkills(t *testing.T) {
|
||||
},
|
||||
}, nil).AnyTimes()
|
||||
|
||||
r.knowledge.EXPECT().Retrieve(gomock.Any(), gomock.Any()).Return(&knowledge.RetrieveResponse{
|
||||
Slices: []*knowledge.Slice{
|
||||
{DocumentID: "1", Output: "天安门广场 :中国政治文化中心,见证了近现代重大历史事件"},
|
||||
{DocumentID: "2", Output: "八达岭长城 :明代长城的精华段,被誉为“不到长城非好汉"},
|
||||
},
|
||||
}, nil).AnyTimes()
|
||||
// r.knowledge.EXPECT().Retrieve(gomock.Any(), gomock.Any()).Return(&knowledge.RetrieveResponse{
|
||||
// RetrieveSlices: []*knowledge.RetrieveSlice{
|
||||
// {Slice: &knowledge.Slice{DocumentID: 1, Output: "天安门广场 :中国政治文化中心,见证了近现代重大历史事件"}, Score: 0.9},
|
||||
// {Slice: &knowledge.Slice{DocumentID: 2, Output: "八达岭长城 :明代长城的精华段,被誉为“不到长城非好汉"}, Score: 0.8},
|
||||
// },
|
||||
// }, nil).AnyTimes()
|
||||
|
||||
t.Run("llm node with knowledge skill", func(t *testing.T) {
|
||||
id := r.load("llm_node_with_skills/llm_with_knowledge_skill.json")
|
||||
exeID := r.testRun(id, map[string]string{
|
||||
"input": "北京有哪些著名的景点",
|
||||
})
|
||||
e := r.getProcess(id, exeID)
|
||||
e.assertSuccess()
|
||||
assert.Equal(t, `{"output":"八达岭长城 :明代长城的精华段,被誉为“不到长城非好汉"}`, e.output)
|
||||
})
|
||||
// t.Run("llm node with knowledge skill", func(t *testing.T) {
|
||||
// id := r.load("llm_node_with_skills/llm_with_knowledge_skill.json")
|
||||
// exeID := r.testRun(id, map[string]string{
|
||||
// "input": "北京有哪些著名的景点",
|
||||
// })
|
||||
// e := r.getProcess(id, exeID)
|
||||
// e.assertSuccess()
|
||||
// assert.Equal(t, `{"output":"八达岭长城 :明代长城的精华段,被誉为“不到长城非好汉"}`, e.output)
|
||||
// })
|
||||
})
|
||||
}
|
||||
|
||||
@ -3401,8 +3410,8 @@ func TestGetLLMNodeFCSettingsDetailAndMerged(t *testing.T) {
|
||||
{ID: 123, Operation: operation},
|
||||
}, nil).AnyTimes()
|
||||
|
||||
pluginSrv := plugin3.NewPluginService(r.plugin, r.tos)
|
||||
plugin.SetPluginService(pluginSrv)
|
||||
pluginSrv := pluginImpl.InitDomainService(r.plugin, r.tos)
|
||||
crossplugin.SetDefaultSVC(pluginSrv)
|
||||
|
||||
t.Run("plugin tool info ", func(t *testing.T) {
|
||||
fcSettingDetailReq := &workflow.GetLLMNodeFCSettingDetailRequest{
|
||||
@ -3518,8 +3527,8 @@ func TestGetLLMNodeFCSettingsDetailAndMerged(t *testing.T) {
|
||||
{ID: 123, Operation: operation},
|
||||
}, nil).AnyTimes()
|
||||
|
||||
pluginSrv := plugin3.NewPluginService(r.plugin, r.tos)
|
||||
plugin.SetPluginService(pluginSrv)
|
||||
pluginSrv := pluginImpl.InitDomainService(r.plugin, r.tos)
|
||||
crossplugin.SetDefaultSVC(pluginSrv)
|
||||
|
||||
t.Run("plugin merge", func(t *testing.T) {
|
||||
fcSettingMergedReq := &workflow.GetLLMNodeFCSettingsMergedRequest{
|
||||
@ -3685,7 +3694,7 @@ func TestCopyWorkflow(t *testing.T) {
|
||||
|
||||
_, err := appworkflow.GetWorkflowDomainSVC().Get(context.Background(), &vo.GetPolicy{
|
||||
ID: wid,
|
||||
QType: vo.FromDraft,
|
||||
QType: workflowModel.FromDraft,
|
||||
CommitID: "",
|
||||
})
|
||||
assert.NotNil(t, err)
|
||||
@ -3747,7 +3756,7 @@ func TestReleaseApplicationWorkflows(t *testing.T) {
|
||||
|
||||
wf, err = appworkflow.GetWorkflowDomainSVC().Get(context.Background(), &vo.GetPolicy{
|
||||
ID: 100100100100,
|
||||
QType: vo.FromSpecificVersion,
|
||||
QType: workflowModel.FromSpecificVersion,
|
||||
Version: version,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
@ -3761,10 +3770,10 @@ func TestReleaseApplicationWorkflows(t *testing.T) {
|
||||
var validateCv func(ns []*vo.Node)
|
||||
validateCv = func(ns []*vo.Node) {
|
||||
for _, n := range ns {
|
||||
if n.Type == vo.BlockTypeBotSubWorkflow {
|
||||
if n.Type == entity.NodeTypeSubWorkflow.IDStr() {
|
||||
assert.Equal(t, n.Data.Inputs.WorkflowVersion, version)
|
||||
}
|
||||
if n.Type == vo.BlockTypeBotAPI {
|
||||
if n.Type == entity.NodeTypePlugin.IDStr() {
|
||||
for _, apiParam := range n.Data.Inputs.APIParams {
|
||||
// In the application, the workflow plugin node When the plugin version is equal to 0, the plugin is a plugin created in the application
|
||||
if apiParam.Name == "pluginVersion" {
|
||||
@ -3773,7 +3782,7 @@ func TestReleaseApplicationWorkflows(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
if n.Type == vo.BlockTypeBotLLM {
|
||||
if n.Type == entity.NodeTypeLLM.IDStr() {
|
||||
if n.Data.Inputs.FCParam != nil && n.Data.Inputs.FCParam.PluginFCParam != nil {
|
||||
// In the application, the workflow llm node When the plugin version is equal to 0, the plugin is a plugin created in the application
|
||||
for _, p := range n.Data.Inputs.FCParam.PluginFCParam.PluginList {
|
||||
@ -4027,7 +4036,7 @@ func TestCopyWorkflowAppToLibrary(t *testing.T) {
|
||||
|
||||
mockey.PatchConvey("copy with subworkflow, subworkflow with external resource ", t, func() {
|
||||
var copiedIDs = make([]int64, 0)
|
||||
var mockPublishWorkflowResource func(ctx context.Context, OpType crosssearch.OpType, event *crosssearch.Resource) error
|
||||
var mockPublishWorkflowResource func(ctx context.Context, workflowID int64, mode *int32, op search.OpType, r *search.ResourceDocument) error
|
||||
var ignoreIDs = map[int64]bool{
|
||||
7515027325977624576: true,
|
||||
7515027249628708864: true,
|
||||
@ -4035,15 +4044,15 @@ func TestCopyWorkflowAppToLibrary(t *testing.T) {
|
||||
7515027150387281920: true,
|
||||
7515027091302121472: true,
|
||||
}
|
||||
mockPublishWorkflowResource = func(ctx context.Context, OpType crosssearch.OpType, event *crosssearch.Resource) error {
|
||||
if ignoreIDs[event.WorkflowID] {
|
||||
mockPublishWorkflowResource = func(ctx context.Context, workflowID int64, mode *int32, op search.OpType, r *search.ResourceDocument) error {
|
||||
if ignoreIDs[workflowID] {
|
||||
return nil
|
||||
}
|
||||
wf, err := appworkflow.GetWorkflowDomainSVC().Get(ctx, &vo.GetPolicy{
|
||||
ID: event.WorkflowID,
|
||||
QType: vo.FromLatestVersion,
|
||||
ID: workflowID,
|
||||
QType: workflowModel.FromLatestVersion,
|
||||
})
|
||||
copiedIDs = append(copiedIDs, event.WorkflowID)
|
||||
copiedIDs = append(copiedIDs, workflowID)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "v0.0.1", wf.Version)
|
||||
canvas := &vo.Canvas{}
|
||||
@ -4057,8 +4066,8 @@ func TestCopyWorkflowAppToLibrary(t *testing.T) {
|
||||
var validateSubWorkflowIDs func(nodes []*vo.Node)
|
||||
validateSubWorkflowIDs = func(nodes []*vo.Node) {
|
||||
for _, node := range nodes {
|
||||
switch node.Type {
|
||||
case vo.BlockTypeBotAPI:
|
||||
switch entity.IDStrToNodeType(node.Type) {
|
||||
case entity.NodeTypePlugin:
|
||||
apiParams := slices.ToMap(node.Data.Inputs.APIParams, func(e *vo.Param) (string, *vo.Param) {
|
||||
return e.Name, e
|
||||
})
|
||||
@ -4076,28 +4085,28 @@ func TestCopyWorkflowAppToLibrary(t *testing.T) {
|
||||
assert.Equal(t, "100100", pID)
|
||||
}
|
||||
|
||||
case vo.BlockTypeBotSubWorkflow:
|
||||
case entity.NodeTypeSubWorkflow:
|
||||
assert.True(t, copiedIDMap[node.Data.Inputs.WorkflowID])
|
||||
wfId, err := strconv.ParseInt(node.Data.Inputs.WorkflowID, 10, 64)
|
||||
assert.NoError(t, err)
|
||||
|
||||
subWf, err := appworkflow.GetWorkflowDomainSVC().Get(ctx, &vo.GetPolicy{
|
||||
ID: wfId,
|
||||
QType: vo.FromLatestVersion,
|
||||
QType: workflowModel.FromLatestVersion,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
subworkflowCanvas := &vo.Canvas{}
|
||||
err = sonic.UnmarshalString(subWf.Canvas, subworkflowCanvas)
|
||||
assert.NoError(t, err)
|
||||
validateSubWorkflowIDs(subworkflowCanvas.Nodes)
|
||||
case vo.BlockTypeBotLLM:
|
||||
if node.Data.Inputs.FCParam != nil && node.Data.Inputs.FCParam.WorkflowFCParam != nil {
|
||||
case entity.NodeTypeLLM:
|
||||
if node.Data.Inputs.LLM != nil && node.Data.Inputs.FCParam != nil && node.Data.Inputs.FCParam.WorkflowFCParam != nil {
|
||||
for _, w := range node.Data.Inputs.FCParam.WorkflowFCParam.WorkflowList {
|
||||
assert.True(t, copiedIDMap[w.WorkflowID])
|
||||
}
|
||||
}
|
||||
|
||||
if node.Data.Inputs.FCParam != nil && node.Data.Inputs.FCParam.PluginFCParam != nil {
|
||||
if node.Data.Inputs.LLM != nil && node.Data.Inputs.FCParam != nil && node.Data.Inputs.FCParam.PluginFCParam != nil {
|
||||
for _, p := range node.Data.Inputs.FCParam.PluginFCParam.PluginList {
|
||||
if p.PluginVersion == "0" {
|
||||
assert.Equal(t, "100100", p.PluginID)
|
||||
@ -4105,18 +4114,18 @@ func TestCopyWorkflowAppToLibrary(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
if node.Data.Inputs.FCParam != nil && node.Data.Inputs.FCParam.KnowledgeFCParam != nil {
|
||||
if node.Data.Inputs.LLM != nil && node.Data.Inputs.FCParam != nil && node.Data.Inputs.FCParam.KnowledgeFCParam != nil {
|
||||
for _, k := range node.Data.Inputs.FCParam.KnowledgeFCParam.KnowledgeList {
|
||||
assert.Equal(t, "100100", k.ID)
|
||||
}
|
||||
}
|
||||
case vo.BlockTypeBotDataset, vo.BlockTypeBotDatasetWrite:
|
||||
case entity.NodeTypeKnowledgeIndexer, entity.NodeTypeKnowledgeRetriever:
|
||||
datasetListInfoParam := node.Data.Inputs.DatasetParam[0]
|
||||
knowledgeIDs := datasetListInfoParam.Input.Value.Content.([]any)
|
||||
for idx := range knowledgeIDs {
|
||||
assert.Equal(t, "100100", knowledgeIDs[idx].(string))
|
||||
}
|
||||
case vo.BlockTypeDatabase, vo.BlockTypeDatabaseSelect, vo.BlockTypeDatabaseInsert, vo.BlockTypeDatabaseDelete, vo.BlockTypeDatabaseUpdate:
|
||||
case entity.NodeTypeDatabaseCustomSQL, entity.NodeTypeDatabaseQuery, entity.NodeTypeDatabaseInsert, entity.NodeTypeDatabaseDelete, entity.NodeTypeDatabaseUpdate:
|
||||
for _, d := range node.Data.Inputs.DatabaseInfoList {
|
||||
assert.Equal(t, "100100", d.DatabaseInfoID)
|
||||
}
|
||||
@ -4132,7 +4141,7 @@ func TestCopyWorkflowAppToLibrary(t *testing.T) {
|
||||
|
||||
}
|
||||
|
||||
r.search.EXPECT().PublishWorkflowResource(gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(mockPublishWorkflowResource).AnyTimes()
|
||||
defer mockey.Mock(appworkflow.PublishWorkflowResource).To(mockPublishWorkflowResource).Build().UnPatch()
|
||||
|
||||
appID := "7513788954458456064"
|
||||
appIDInt64, _ := strconv.ParseInt(appID, 10, 64)
|
||||
@ -4175,21 +4184,21 @@ func TestCopyWorkflowAppToLibrary(t *testing.T) {
|
||||
|
||||
mockey.PatchConvey("copy only with external resource", t, func() {
|
||||
var copiedIDs = make([]int64, 0)
|
||||
var mockPublishWorkflowResource func(ctx context.Context, OpType crosssearch.OpType, event *crosssearch.Resource) error
|
||||
var mockPublishWorkflowResource func(ctx context.Context, workflowID int64, mode *int32, op search.OpType, r *search.ResourceDocument) error
|
||||
var ignoreIDs = map[int64]bool{
|
||||
7516518409656336384: true,
|
||||
7516516198096306176: true,
|
||||
}
|
||||
mockPublishWorkflowResource = func(ctx context.Context, OpType crosssearch.OpType, event *crosssearch.Resource) error {
|
||||
if ignoreIDs[event.WorkflowID] {
|
||||
mockPublishWorkflowResource = func(ctx context.Context, workflowID int64, mode *int32, op search.OpType, r *search.ResourceDocument) error {
|
||||
if ignoreIDs[workflowID] {
|
||||
return nil
|
||||
}
|
||||
wf, err := appworkflow.GetWorkflowDomainSVC().Get(ctx, &vo.GetPolicy{
|
||||
ID: event.WorkflowID,
|
||||
QType: vo.FromLatestVersion,
|
||||
ID: workflowID,
|
||||
QType: workflowModel.FromLatestVersion,
|
||||
})
|
||||
|
||||
copiedIDs = append(copiedIDs, event.WorkflowID)
|
||||
copiedIDs = append(copiedIDs, workflowID)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "v0.0.1", wf.Version)
|
||||
canvas := &vo.Canvas{}
|
||||
@ -4202,10 +4211,10 @@ func TestCopyWorkflowAppToLibrary(t *testing.T) {
|
||||
var validateSubWorkflowIDs func(nodes []*vo.Node)
|
||||
validateSubWorkflowIDs = func(nodes []*vo.Node) {
|
||||
for _, node := range nodes {
|
||||
switch node.Type {
|
||||
case vo.BlockTypeBotSubWorkflow:
|
||||
switch entity.IDStrToNodeType(node.Type) {
|
||||
case entity.NodeTypeSubWorkflow:
|
||||
assert.True(t, copiedIDMap[node.Data.Inputs.WorkflowID])
|
||||
case vo.BlockTypeBotLLM:
|
||||
case entity.NodeTypeLLM:
|
||||
if node.Data.Inputs.FCParam != nil && node.Data.Inputs.FCParam.WorkflowFCParam != nil {
|
||||
for _, w := range node.Data.Inputs.FCParam.WorkflowFCParam.WorkflowList {
|
||||
assert.True(t, copiedIDMap[w.WorkflowID])
|
||||
@ -4223,13 +4232,13 @@ func TestCopyWorkflowAppToLibrary(t *testing.T) {
|
||||
assert.Equal(t, "100100", k.ID)
|
||||
}
|
||||
}
|
||||
case vo.BlockTypeBotDataset, vo.BlockTypeBotDatasetWrite:
|
||||
case entity.NodeTypeKnowledgeIndexer, entity.NodeTypeKnowledgeRetriever:
|
||||
datasetListInfoParam := node.Data.Inputs.DatasetParam[0]
|
||||
knowledgeIDs := datasetListInfoParam.Input.Value.Content.([]any)
|
||||
for idx := range knowledgeIDs {
|
||||
assert.Equal(t, "100100", knowledgeIDs[idx].(string))
|
||||
}
|
||||
case vo.BlockTypeDatabase, vo.BlockTypeDatabaseSelect, vo.BlockTypeDatabaseInsert, vo.BlockTypeDatabaseDelete, vo.BlockTypeDatabaseUpdate:
|
||||
case entity.NodeTypeDatabaseCustomSQL, entity.NodeTypeDatabaseQuery, entity.NodeTypeDatabaseInsert, entity.NodeTypeDatabaseDelete, entity.NodeTypeDatabaseUpdate:
|
||||
for _, d := range node.Data.Inputs.DatabaseInfoList {
|
||||
assert.Equal(t, "100100", d.DatabaseInfoID)
|
||||
}
|
||||
@ -4244,7 +4253,7 @@ func TestCopyWorkflowAppToLibrary(t *testing.T) {
|
||||
|
||||
}
|
||||
|
||||
r.search.EXPECT().PublishWorkflowResource(gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(mockPublishWorkflowResource).AnyTimes()
|
||||
defer mockey.Mock(appworkflow.PublishWorkflowResource).To(mockPublishWorkflowResource).Build().UnPatch()
|
||||
|
||||
defer mockey.Mock((*appknowledge.KnowledgeApplicationService).CopyKnowledge).Return(&modelknowledge.CopyKnowledgeResponse{
|
||||
TargetKnowledgeID: 100100,
|
||||
@ -4285,6 +4294,7 @@ func TestCopyWorkflowAppToLibrary(t *testing.T) {
|
||||
func TestMoveWorkflowAppToLibrary(t *testing.T) {
|
||||
mockey.PatchConvey("test move workflow", t, func() {
|
||||
r := newWfTestRunner(t)
|
||||
r.publishPatcher.UnPatch()
|
||||
defer r.closeFn()
|
||||
vars := map[string]*vo.TypeInfo{
|
||||
"app_v1": {
|
||||
@ -4304,21 +4314,21 @@ func TestMoveWorkflowAppToLibrary(t *testing.T) {
|
||||
r.varGetter.EXPECT().GetAppVariablesMeta(gomock.Any(), gomock.Any(), gomock.Any()).Return(vars, nil).AnyTimes()
|
||||
t.Run("move workflow", func(t *testing.T) {
|
||||
|
||||
var mockPublishWorkflowResource func(ctx context.Context, OpType crosssearch.OpType, event *crosssearch.Resource) error
|
||||
var mockPublishWorkflowResource func(ctx context.Context, workflowID int64, mode *int32, op search.OpType, r *search.ResourceDocument) error
|
||||
|
||||
named2Idx := []string{"c1", "c2", "cc1", "main"}
|
||||
callCount := 0
|
||||
initialWf2ID := map[string]int64{}
|
||||
old2newID := map[int64]int64{}
|
||||
mockPublishWorkflowResource = func(ctx context.Context, OpType crosssearch.OpType, event *crosssearch.Resource) error {
|
||||
mockPublishWorkflowResource = func(ctx context.Context, workflowID int64, mode *int32, op search.OpType, r *search.ResourceDocument) error {
|
||||
if callCount <= 3 {
|
||||
initialWf2ID[named2Idx[callCount]] = event.WorkflowID
|
||||
initialWf2ID[named2Idx[callCount]] = workflowID
|
||||
callCount++
|
||||
return nil
|
||||
}
|
||||
if OpType == crosssearch.Created {
|
||||
if oldID, ok := initialWf2ID[*event.Name]; ok {
|
||||
old2newID[oldID] = event.WorkflowID
|
||||
if op == search.Created {
|
||||
if oldID, ok := initialWf2ID[*r.Name]; ok {
|
||||
old2newID[oldID] = workflowID
|
||||
}
|
||||
}
|
||||
|
||||
@ -4326,7 +4336,7 @@ func TestMoveWorkflowAppToLibrary(t *testing.T) {
|
||||
|
||||
}
|
||||
|
||||
r.search.EXPECT().PublishWorkflowResource(gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(mockPublishWorkflowResource).AnyTimes()
|
||||
defer mockey.Mock(appworkflow.PublishWorkflowResource).To(mockPublishWorkflowResource).Build().UnPatch()
|
||||
|
||||
defer mockey.Mock((*appknowledge.KnowledgeApplicationService).MoveKnowledgeToLibrary).Return(nil).Build().UnPatch()
|
||||
defer mockey.Mock((*appmemory.DatabaseApplicationService).MoveDatabaseToLibrary).Return(&appmemory.MoveDatabaseToLibraryResponse{}, nil).Build().UnPatch()
|
||||
@ -4350,7 +4360,7 @@ func TestMoveWorkflowAppToLibrary(t *testing.T) {
|
||||
err = sonic.Unmarshal(data, mainCanvas)
|
||||
assert.NoError(t, err)
|
||||
for _, node := range mainCanvas.Nodes {
|
||||
if node.Type == vo.BlockTypeBotSubWorkflow {
|
||||
if node.Type == entity.NodeTypeSubWorkflow.IDStr() {
|
||||
if node.Data.Inputs.WorkflowID == "7516826260387921920" {
|
||||
node.Data.Inputs.WorkflowID = c1IdStr
|
||||
}
|
||||
@ -4366,7 +4376,7 @@ func TestMoveWorkflowAppToLibrary(t *testing.T) {
|
||||
err = sonic.Unmarshal(cc1Data, cc1Canvas)
|
||||
assert.NoError(t, err)
|
||||
for _, node := range cc1Canvas.Nodes {
|
||||
if node.Type == vo.BlockTypeBotSubWorkflow {
|
||||
if node.Type == entity.NodeTypeSubWorkflow.IDStr() {
|
||||
if node.Data.Inputs.WorkflowID == "7516826283318181888" {
|
||||
node.Data.Inputs.WorkflowID = c2IdStr
|
||||
}
|
||||
@ -4417,7 +4427,7 @@ func TestMoveWorkflowAppToLibrary(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
|
||||
for _, node := range newMainCanvas.Nodes {
|
||||
if node.Type == vo.BlockTypeBotSubWorkflow {
|
||||
if node.Type == entity.NodeTypeSubWorkflow.IDStr() {
|
||||
assert.True(t, newSubWorkflowID[node.Data.Inputs.WorkflowID])
|
||||
assert.Equal(t, "v0.0.1", node.Data.Inputs.WorkflowVersion)
|
||||
}
|
||||
@ -4431,7 +4441,7 @@ func TestMoveWorkflowAppToLibrary(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
|
||||
for _, node := range cc1Canvas.Nodes {
|
||||
if node.Type == vo.BlockTypeBotSubWorkflow {
|
||||
if node.Type == entity.NodeTypeSubWorkflow.IDStr() {
|
||||
assert.True(t, newSubWorkflowID[node.Data.Inputs.WorkflowID])
|
||||
assert.Equal(t, "v0.0.1", node.Data.Inputs.WorkflowVersion)
|
||||
}
|
||||
@ -4444,6 +4454,7 @@ func TestMoveWorkflowAppToLibrary(t *testing.T) {
|
||||
func TestDuplicateWorkflowsByAppID(t *testing.T) {
|
||||
mockey.PatchConvey("test duplicate work", t, func() {
|
||||
r := newWfTestRunner(t)
|
||||
r.publishPatcher.UnPatch()
|
||||
defer r.closeFn()
|
||||
|
||||
vars := map[string]*vo.TypeInfo{
|
||||
@ -4463,7 +4474,7 @@ func TestDuplicateWorkflowsByAppID(t *testing.T) {
|
||||
|
||||
r.varGetter.EXPECT().GetAppVariablesMeta(gomock.Any(), gomock.Any(), gomock.Any()).Return(vars, nil).AnyTimes()
|
||||
var copiedIDs = make([]int64, 0)
|
||||
var mockPublishWorkflowResource func(ctx context.Context, OpType crosssearch.OpType, event *crosssearch.Resource) error
|
||||
var mockPublishWorkflowResource func(ctx context.Context, workflowID int64, mode *int32, op search.OpType, r *search.ResourceDocument) error
|
||||
var ignoreIDs = map[int64]bool{
|
||||
7515027325977624576: true,
|
||||
7515027249628708864: true,
|
||||
@ -4472,16 +4483,16 @@ func TestDuplicateWorkflowsByAppID(t *testing.T) {
|
||||
7515027091302121472: true,
|
||||
7515027325977624579: true,
|
||||
}
|
||||
mockPublishWorkflowResource = func(ctx context.Context, OpType crosssearch.OpType, event *crosssearch.Resource) error {
|
||||
if ignoreIDs[event.WorkflowID] {
|
||||
mockPublishWorkflowResource = func(ctx context.Context, workflowID int64, mode *int32, op search.OpType, r *search.ResourceDocument) error {
|
||||
if ignoreIDs[workflowID] {
|
||||
return nil
|
||||
}
|
||||
copiedIDs = append(copiedIDs, event.WorkflowID)
|
||||
copiedIDs = append(copiedIDs, workflowID)
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
r.search.EXPECT().PublishWorkflowResource(gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(mockPublishWorkflowResource).AnyTimes()
|
||||
defer mockey.Mock(appworkflow.PublishWorkflowResource).To(mockPublishWorkflowResource).Build().UnPatch()
|
||||
|
||||
appIDInt64 := int64(7513788954458456064)
|
||||
|
||||
@ -4502,10 +4513,10 @@ func TestDuplicateWorkflowsByAppID(t *testing.T) {
|
||||
var validateSubWorkflowIDs func(nodes []*vo.Node)
|
||||
validateSubWorkflowIDs = func(nodes []*vo.Node) {
|
||||
for _, node := range nodes {
|
||||
if node.Type == vo.BlockTypeBotSubWorkflow {
|
||||
if node.Type == entity.NodeTypeSubWorkflow.IDStr() {
|
||||
assert.True(t, copiedIDMap[node.Data.Inputs.WorkflowID])
|
||||
}
|
||||
if node.Type == vo.BlockTypeBotLLM {
|
||||
if node.Type == entity.NodeTypeLLM.IDStr() {
|
||||
if node.Data.Inputs.FCParam != nil && node.Data.Inputs.FCParam.WorkflowFCParam != nil {
|
||||
for _, w := range node.Data.Inputs.FCParam.WorkflowFCParam.WorkflowList {
|
||||
assert.True(t, copiedIDMap[w.WorkflowID])
|
||||
@ -4649,7 +4660,7 @@ func TestJsonSerializationDeserializationWithWarning(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestSetAppVariablesFOrSubProcesses(t *testing.T) {
|
||||
func TestSetAppVariablesForSubProcesses(t *testing.T) {
|
||||
mockey.PatchConvey("app variables for sub_process", t, func() {
|
||||
r := newWfTestRunner(t)
|
||||
defer r.closeFn()
|
||||
@ -4666,3 +4677,79 @@ func TestSetAppVariablesFOrSubProcesses(t *testing.T) {
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
func TestHttpImplicitDependencies(t *testing.T) {
|
||||
mockey.PatchConvey("test http implicit dependencies", t, func() {
|
||||
r := newWfTestRunner(t)
|
||||
defer r.closeFn()
|
||||
|
||||
r.appVarS.EXPECT().Get(gomock.Any(), gomock.Any(), gomock.Any()).Return("1.0", nil).AnyTimes()
|
||||
|
||||
idStr := r.load("httprequester/http_implicit_dependencies.json")
|
||||
|
||||
r.publish(idStr, "v0.0.1", true)
|
||||
|
||||
runner := mockcode.NewMockRunner(r.ctrl)
|
||||
runner.EXPECT().Run(gomock.Any(), gomock.Any()).DoAndReturn(func(ctx context.Context, request *coderunner.RunRequest) (*coderunner.RunResponse, error) {
|
||||
in := request.Params["input"]
|
||||
_ = in
|
||||
result := make(map[string]any)
|
||||
err := sonic.UnmarshalString(in.(string), &result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &coderunner.RunResponse{
|
||||
Result: result,
|
||||
}, nil
|
||||
}).AnyTimes()
|
||||
|
||||
code.SetCodeRunner(runner)
|
||||
|
||||
mockey.PatchConvey("test http node implicit dependencies", func() {
|
||||
input := map[string]string{
|
||||
"input": "a",
|
||||
}
|
||||
result, _ := r.openapiSyncRun(idStr, input)
|
||||
|
||||
batchRets := result["batch"].([]any)
|
||||
loopRets := result["loop"].([]any)
|
||||
|
||||
for _, r := range batchRets {
|
||||
assert.Contains(t, []any{
|
||||
"http://echo.apifox.com/anything?aa=1.0&cc=1",
|
||||
"http://echo.apifox.com/anything?aa=1.0&cc=2",
|
||||
}, r)
|
||||
}
|
||||
for _, r := range loopRets {
|
||||
assert.Contains(t, []any{
|
||||
"http://echo.apifox.com/anything?a=1&m=123",
|
||||
"http://echo.apifox.com/anything?a=2&m=123",
|
||||
}, r)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
mockey.PatchConvey("node debug http node implicit dependencies", func() {
|
||||
exeID := r.nodeDebug(idStr, "109387",
|
||||
withNDInput(map[string]string{
|
||||
"__apiInfo_url_87fc7c69536cae843fa7f5113cf0067b": "m",
|
||||
"__apiInfo_url_ac86361e3cd503952e71986dc091fa6f": "a",
|
||||
"__body_bodyData_json_ac86361e3cd503952e71986dc091fa6f": "b",
|
||||
"__body_bodyData_json_f77817a7cf8441279e1cfd8af4eeb1da": "1",
|
||||
}))
|
||||
|
||||
e := r.getProcess(idStr, exeID, withSpecificNodeID("109387"))
|
||||
e.assertSuccess()
|
||||
|
||||
ret := make(map[string]any)
|
||||
err := sonic.UnmarshalString(e.output, &ret)
|
||||
assert.Nil(t, err)
|
||||
err = sonic.UnmarshalString(ret["body"].(string), &ret)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, ret["url"].(string), "http://echo.apifox.com/anything?a=a&m=m")
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
@ -61,9 +61,13 @@ func isStaticFile(ctx *app.RequestContext) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
if strings.HasPrefix(string(path), "/static/") ||
|
||||
strings.HasPrefix(string(path), "/explore/") ||
|
||||
strings.HasPrefix(string(path), "/space/") {
|
||||
if strings.HasPrefix(path, "/static/") ||
|
||||
strings.HasPrefix(path, "/explore/") ||
|
||||
strings.HasPrefix(path, "/space/") {
|
||||
return true
|
||||
}
|
||||
|
||||
if path == "/information/auth/success" {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
2887
backend/api/model/app/bot_open_api/bot_open_api.go
Normal file
2887
backend/api/model/app/bot_open_api/bot_open_api.go
Normal file
File diff suppressed because it is too large
Load Diff
@ -8,8 +8,8 @@ import (
|
||||
"database/sql/driver"
|
||||
"fmt"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/bot_common"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/playground"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/app/bot_common"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/playground"
|
||||
)
|
||||
|
||||
type VisibilityType int64
|
||||
@ -1,6 +1,6 @@
|
||||
// Code generated by thriftgo (0.4.1). DO NOT EDIT.
|
||||
|
||||
package task_struct
|
||||
package common
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2025 coze-dev Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by thriftgo (0.4.1). DO NOT EDIT.
|
||||
|
||||
package intelligence
|
||||
@ -6,9 +22,9 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/project"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/publish"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/task"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/app/intelligence/project"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/app/intelligence/publish"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/app/intelligence/task"
|
||||
)
|
||||
|
||||
type IntelligenceService interface {
|
||||
@ -5,8 +5,8 @@ package project
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/app/intelligence/common"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/base"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/intelligence/common"
|
||||
)
|
||||
|
||||
type DraftProjectCreateRequest struct {
|
||||
@ -7,8 +7,8 @@ import (
|
||||
"database/sql/driver"
|
||||
"fmt"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/app/intelligence/common"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/base"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/intelligence/common"
|
||||
)
|
||||
|
||||
type ConnectorClassification int64
|
||||
@ -7,8 +7,8 @@ import (
|
||||
"database/sql/driver"
|
||||
"fmt"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/app/intelligence/common"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/base"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/intelligence/common"
|
||||
)
|
||||
|
||||
type OrderBy int64
|
||||
@ -5,8 +5,8 @@ package task
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/app/intelligence/common"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/base"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/task_struct"
|
||||
)
|
||||
|
||||
type DraftProjectInnerTaskListRequest struct {
|
||||
@ -513,7 +513,7 @@ func (p *DraftProjectInnerTaskListResponse) String() string {
|
||||
}
|
||||
|
||||
type DraftProjectInnerTaskListData struct {
|
||||
TaskList []*task_struct.ProjectInnerTaskInfo `thrift:"task_list,1" form:"task_list" json:"task_list" query:"task_list"`
|
||||
TaskList []*common.ProjectInnerTaskInfo `thrift:"task_list,1" form:"task_list" json:"task_list" query:"task_list"`
|
||||
}
|
||||
|
||||
func NewDraftProjectInnerTaskListData() *DraftProjectInnerTaskListData {
|
||||
@ -523,7 +523,7 @@ func NewDraftProjectInnerTaskListData() *DraftProjectInnerTaskListData {
|
||||
func (p *DraftProjectInnerTaskListData) InitDefault() {
|
||||
}
|
||||
|
||||
func (p *DraftProjectInnerTaskListData) GetTaskList() (v []*task_struct.ProjectInnerTaskInfo) {
|
||||
func (p *DraftProjectInnerTaskListData) GetTaskList() (v []*common.ProjectInnerTaskInfo) {
|
||||
return p.TaskList
|
||||
}
|
||||
|
||||
@ -591,8 +591,8 @@ func (p *DraftProjectInnerTaskListData) ReadField1(iprot thrift.TProtocol) error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_field := make([]*task_struct.ProjectInnerTaskInfo, 0, size)
|
||||
values := make([]task_struct.ProjectInnerTaskInfo, size)
|
||||
_field := make([]*common.ProjectInnerTaskInfo, 0, size)
|
||||
values := make([]common.ProjectInnerTaskInfo, size)
|
||||
for i := 0; i < size; i++ {
|
||||
_elem := &values[i]
|
||||
_elem.InitDefault()
|
||||
@ -1,765 +0,0 @@
|
||||
// Code generated by thriftgo (0.4.1). DO NOT EDIT.
|
||||
|
||||
package common
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"database/sql/driver"
|
||||
"fmt"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
)
|
||||
|
||||
type ColumnType int64
|
||||
|
||||
const (
|
||||
ColumnType_Unknown ColumnType = 0
|
||||
// Text
|
||||
ColumnType_Text ColumnType = 1
|
||||
// number
|
||||
ColumnType_Number ColumnType = 2
|
||||
// time
|
||||
ColumnType_Date ColumnType = 3
|
||||
// float
|
||||
ColumnType_Float ColumnType = 4
|
||||
// bool
|
||||
ColumnType_Boolean ColumnType = 5
|
||||
// picture
|
||||
ColumnType_Image ColumnType = 6
|
||||
)
|
||||
|
||||
func (p ColumnType) String() string {
|
||||
switch p {
|
||||
case ColumnType_Unknown:
|
||||
return "Unknown"
|
||||
case ColumnType_Text:
|
||||
return "Text"
|
||||
case ColumnType_Number:
|
||||
return "Number"
|
||||
case ColumnType_Date:
|
||||
return "Date"
|
||||
case ColumnType_Float:
|
||||
return "Float"
|
||||
case ColumnType_Boolean:
|
||||
return "Boolean"
|
||||
case ColumnType_Image:
|
||||
return "Image"
|
||||
}
|
||||
return "<UNSET>"
|
||||
}
|
||||
|
||||
func ColumnTypeFromString(s string) (ColumnType, error) {
|
||||
switch s {
|
||||
case "Unknown":
|
||||
return ColumnType_Unknown, nil
|
||||
case "Text":
|
||||
return ColumnType_Text, nil
|
||||
case "Number":
|
||||
return ColumnType_Number, nil
|
||||
case "Date":
|
||||
return ColumnType_Date, nil
|
||||
case "Float":
|
||||
return ColumnType_Float, nil
|
||||
case "Boolean":
|
||||
return ColumnType_Boolean, nil
|
||||
case "Image":
|
||||
return ColumnType_Image, nil
|
||||
}
|
||||
return ColumnType(0), fmt.Errorf("not a valid ColumnType string")
|
||||
}
|
||||
|
||||
func ColumnTypePtr(v ColumnType) *ColumnType { return &v }
|
||||
func (p *ColumnType) Scan(value interface{}) (err error) {
|
||||
var result sql.NullInt64
|
||||
err = result.Scan(value)
|
||||
*p = ColumnType(result.Int64)
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ColumnType) Value() (driver.Value, error) {
|
||||
if p == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return int64(*p), nil
|
||||
}
|
||||
|
||||
type DocTableSheet struct {
|
||||
// Number of sheet
|
||||
ID int64 `thrift:"id,1" form:"id" json:"id" query:"id"`
|
||||
// Sheet name
|
||||
SheetName string `thrift:"sheet_name,2" form:"sheet_name" json:"sheet_name" query:"sheet_name"`
|
||||
// total number of rows
|
||||
TotalRow int64 `thrift:"total_row,3" form:"total_row" json:"total_row" query:"total_row"`
|
||||
}
|
||||
|
||||
func NewDocTableSheet() *DocTableSheet {
|
||||
return &DocTableSheet{}
|
||||
}
|
||||
|
||||
func (p *DocTableSheet) InitDefault() {
|
||||
}
|
||||
|
||||
func (p *DocTableSheet) GetID() (v int64) {
|
||||
return p.ID
|
||||
}
|
||||
|
||||
func (p *DocTableSheet) GetSheetName() (v string) {
|
||||
return p.SheetName
|
||||
}
|
||||
|
||||
func (p *DocTableSheet) GetTotalRow() (v int64) {
|
||||
return p.TotalRow
|
||||
}
|
||||
|
||||
var fieldIDToName_DocTableSheet = map[int16]string{
|
||||
1: "id",
|
||||
2: "sheet_name",
|
||||
3: "total_row",
|
||||
}
|
||||
|
||||
func (p *DocTableSheet) Read(iprot thrift.TProtocol) (err error) {
|
||||
var fieldTypeId thrift.TType
|
||||
var fieldId int16
|
||||
|
||||
if _, err = iprot.ReadStructBegin(); err != nil {
|
||||
goto ReadStructBeginError
|
||||
}
|
||||
|
||||
for {
|
||||
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
||||
if err != nil {
|
||||
goto ReadFieldBeginError
|
||||
}
|
||||
if fieldTypeId == thrift.STOP {
|
||||
break
|
||||
}
|
||||
|
||||
switch fieldId {
|
||||
case 1:
|
||||
if fieldTypeId == thrift.I64 {
|
||||
if err = p.ReadField1(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 2:
|
||||
if fieldTypeId == thrift.STRING {
|
||||
if err = p.ReadField2(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 3:
|
||||
if fieldTypeId == thrift.I64 {
|
||||
if err = p.ReadField3(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
default:
|
||||
if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadFieldEnd(); err != nil {
|
||||
goto ReadFieldEndError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadStructEnd(); err != nil {
|
||||
goto ReadStructEndError
|
||||
}
|
||||
|
||||
return nil
|
||||
ReadStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
||||
ReadFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
||||
ReadFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_DocTableSheet[fieldId]), err)
|
||||
SkipFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
||||
|
||||
ReadFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
||||
ReadStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *DocTableSheet) ReadField1(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field int64
|
||||
if v, err := iprot.ReadI64(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = v
|
||||
}
|
||||
p.ID = _field
|
||||
return nil
|
||||
}
|
||||
func (p *DocTableSheet) ReadField2(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field string
|
||||
if v, err := iprot.ReadString(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = v
|
||||
}
|
||||
p.SheetName = _field
|
||||
return nil
|
||||
}
|
||||
func (p *DocTableSheet) ReadField3(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field int64
|
||||
if v, err := iprot.ReadI64(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = v
|
||||
}
|
||||
p.TotalRow = _field
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *DocTableSheet) Write(oprot thrift.TProtocol) (err error) {
|
||||
var fieldId int16
|
||||
if err = oprot.WriteStructBegin("DocTableSheet"); err != nil {
|
||||
goto WriteStructBeginError
|
||||
}
|
||||
if p != nil {
|
||||
if err = p.writeField1(oprot); err != nil {
|
||||
fieldId = 1
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField2(oprot); err != nil {
|
||||
fieldId = 2
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField3(oprot); err != nil {
|
||||
fieldId = 3
|
||||
goto WriteFieldError
|
||||
}
|
||||
}
|
||||
if err = oprot.WriteFieldStop(); err != nil {
|
||||
goto WriteFieldStopError
|
||||
}
|
||||
if err = oprot.WriteStructEnd(); err != nil {
|
||||
goto WriteStructEndError
|
||||
}
|
||||
return nil
|
||||
WriteStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
||||
WriteFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
||||
WriteFieldStopError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
||||
WriteStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *DocTableSheet) writeField1(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("id", thrift.I64, 1); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteI64(p.ID); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
|
||||
}
|
||||
func (p *DocTableSheet) writeField2(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("sheet_name", thrift.STRING, 2); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteString(p.SheetName); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err)
|
||||
}
|
||||
func (p *DocTableSheet) writeField3(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("total_row", thrift.I64, 3); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteI64(p.TotalRow); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *DocTableSheet) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("DocTableSheet(%+v)", *p)
|
||||
|
||||
}
|
||||
|
||||
// Table column information
|
||||
type DocTableColumn struct {
|
||||
// Column ID
|
||||
ID int64 `thrift:"id,1" form:"id" json:"id,string"`
|
||||
// column_name
|
||||
ColumnName string `thrift:"column_name,2" form:"column_name" json:"column_name" query:"column_name"`
|
||||
// Is it a semantically matched column?
|
||||
IsSemantic bool `thrift:"is_semantic,3" form:"is_semantic" json:"is_semantic" query:"is_semantic"`
|
||||
// List the serial number originally in excel
|
||||
Sequence int64 `thrift:"sequence,4" form:"sequence" json:"sequence,string"`
|
||||
// column type
|
||||
ColumnType *ColumnType `thrift:"column_type,5,optional" form:"column_type" json:"column_type,omitempty" query:"column_type"`
|
||||
ContainsEmptyValue *bool `thrift:"contains_empty_value,6,optional" form:"contains_empty_value" json:"contains_empty_value,omitempty" query:"contains_empty_value"`
|
||||
// describe
|
||||
Desc *string `thrift:"desc,7,optional" form:"desc" json:"desc,omitempty" query:"desc"`
|
||||
}
|
||||
|
||||
func NewDocTableColumn() *DocTableColumn {
|
||||
return &DocTableColumn{}
|
||||
}
|
||||
|
||||
func (p *DocTableColumn) InitDefault() {
|
||||
}
|
||||
|
||||
func (p *DocTableColumn) GetID() (v int64) {
|
||||
return p.ID
|
||||
}
|
||||
|
||||
func (p *DocTableColumn) GetColumnName() (v string) {
|
||||
return p.ColumnName
|
||||
}
|
||||
|
||||
func (p *DocTableColumn) GetIsSemantic() (v bool) {
|
||||
return p.IsSemantic
|
||||
}
|
||||
|
||||
func (p *DocTableColumn) GetSequence() (v int64) {
|
||||
return p.Sequence
|
||||
}
|
||||
|
||||
var DocTableColumn_ColumnType_DEFAULT ColumnType
|
||||
|
||||
func (p *DocTableColumn) GetColumnType() (v ColumnType) {
|
||||
if !p.IsSetColumnType() {
|
||||
return DocTableColumn_ColumnType_DEFAULT
|
||||
}
|
||||
return *p.ColumnType
|
||||
}
|
||||
|
||||
var DocTableColumn_ContainsEmptyValue_DEFAULT bool
|
||||
|
||||
func (p *DocTableColumn) GetContainsEmptyValue() (v bool) {
|
||||
if !p.IsSetContainsEmptyValue() {
|
||||
return DocTableColumn_ContainsEmptyValue_DEFAULT
|
||||
}
|
||||
return *p.ContainsEmptyValue
|
||||
}
|
||||
|
||||
var DocTableColumn_Desc_DEFAULT string
|
||||
|
||||
func (p *DocTableColumn) GetDesc() (v string) {
|
||||
if !p.IsSetDesc() {
|
||||
return DocTableColumn_Desc_DEFAULT
|
||||
}
|
||||
return *p.Desc
|
||||
}
|
||||
|
||||
var fieldIDToName_DocTableColumn = map[int16]string{
|
||||
1: "id",
|
||||
2: "column_name",
|
||||
3: "is_semantic",
|
||||
4: "sequence",
|
||||
5: "column_type",
|
||||
6: "contains_empty_value",
|
||||
7: "desc",
|
||||
}
|
||||
|
||||
func (p *DocTableColumn) IsSetColumnType() bool {
|
||||
return p.ColumnType != nil
|
||||
}
|
||||
|
||||
func (p *DocTableColumn) IsSetContainsEmptyValue() bool {
|
||||
return p.ContainsEmptyValue != nil
|
||||
}
|
||||
|
||||
func (p *DocTableColumn) IsSetDesc() bool {
|
||||
return p.Desc != nil
|
||||
}
|
||||
|
||||
func (p *DocTableColumn) Read(iprot thrift.TProtocol) (err error) {
|
||||
var fieldTypeId thrift.TType
|
||||
var fieldId int16
|
||||
|
||||
if _, err = iprot.ReadStructBegin(); err != nil {
|
||||
goto ReadStructBeginError
|
||||
}
|
||||
|
||||
for {
|
||||
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
||||
if err != nil {
|
||||
goto ReadFieldBeginError
|
||||
}
|
||||
if fieldTypeId == thrift.STOP {
|
||||
break
|
||||
}
|
||||
|
||||
switch fieldId {
|
||||
case 1:
|
||||
if fieldTypeId == thrift.I64 {
|
||||
if err = p.ReadField1(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 2:
|
||||
if fieldTypeId == thrift.STRING {
|
||||
if err = p.ReadField2(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 3:
|
||||
if fieldTypeId == thrift.BOOL {
|
||||
if err = p.ReadField3(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 4:
|
||||
if fieldTypeId == thrift.I64 {
|
||||
if err = p.ReadField4(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 5:
|
||||
if fieldTypeId == thrift.I32 {
|
||||
if err = p.ReadField5(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 6:
|
||||
if fieldTypeId == thrift.BOOL {
|
||||
if err = p.ReadField6(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 7:
|
||||
if fieldTypeId == thrift.STRING {
|
||||
if err = p.ReadField7(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
default:
|
||||
if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadFieldEnd(); err != nil {
|
||||
goto ReadFieldEndError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadStructEnd(); err != nil {
|
||||
goto ReadStructEndError
|
||||
}
|
||||
|
||||
return nil
|
||||
ReadStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
||||
ReadFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
||||
ReadFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_DocTableColumn[fieldId]), err)
|
||||
SkipFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
||||
|
||||
ReadFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
||||
ReadStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *DocTableColumn) ReadField1(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field int64
|
||||
if v, err := iprot.ReadI64(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = v
|
||||
}
|
||||
p.ID = _field
|
||||
return nil
|
||||
}
|
||||
func (p *DocTableColumn) ReadField2(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field string
|
||||
if v, err := iprot.ReadString(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = v
|
||||
}
|
||||
p.ColumnName = _field
|
||||
return nil
|
||||
}
|
||||
func (p *DocTableColumn) ReadField3(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field bool
|
||||
if v, err := iprot.ReadBool(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = v
|
||||
}
|
||||
p.IsSemantic = _field
|
||||
return nil
|
||||
}
|
||||
func (p *DocTableColumn) ReadField4(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field int64
|
||||
if v, err := iprot.ReadI64(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = v
|
||||
}
|
||||
p.Sequence = _field
|
||||
return nil
|
||||
}
|
||||
func (p *DocTableColumn) ReadField5(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field *ColumnType
|
||||
if v, err := iprot.ReadI32(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
tmp := ColumnType(v)
|
||||
_field = &tmp
|
||||
}
|
||||
p.ColumnType = _field
|
||||
return nil
|
||||
}
|
||||
func (p *DocTableColumn) ReadField6(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field *bool
|
||||
if v, err := iprot.ReadBool(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = &v
|
||||
}
|
||||
p.ContainsEmptyValue = _field
|
||||
return nil
|
||||
}
|
||||
func (p *DocTableColumn) ReadField7(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field *string
|
||||
if v, err := iprot.ReadString(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = &v
|
||||
}
|
||||
p.Desc = _field
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *DocTableColumn) Write(oprot thrift.TProtocol) (err error) {
|
||||
var fieldId int16
|
||||
if err = oprot.WriteStructBegin("DocTableColumn"); err != nil {
|
||||
goto WriteStructBeginError
|
||||
}
|
||||
if p != nil {
|
||||
if err = p.writeField1(oprot); err != nil {
|
||||
fieldId = 1
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField2(oprot); err != nil {
|
||||
fieldId = 2
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField3(oprot); err != nil {
|
||||
fieldId = 3
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField4(oprot); err != nil {
|
||||
fieldId = 4
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField5(oprot); err != nil {
|
||||
fieldId = 5
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField6(oprot); err != nil {
|
||||
fieldId = 6
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField7(oprot); err != nil {
|
||||
fieldId = 7
|
||||
goto WriteFieldError
|
||||
}
|
||||
}
|
||||
if err = oprot.WriteFieldStop(); err != nil {
|
||||
goto WriteFieldStopError
|
||||
}
|
||||
if err = oprot.WriteStructEnd(); err != nil {
|
||||
goto WriteStructEndError
|
||||
}
|
||||
return nil
|
||||
WriteStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
||||
WriteFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
||||
WriteFieldStopError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
||||
WriteStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *DocTableColumn) writeField1(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("id", thrift.I64, 1); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteI64(p.ID); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
|
||||
}
|
||||
func (p *DocTableColumn) writeField2(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("column_name", thrift.STRING, 2); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteString(p.ColumnName); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err)
|
||||
}
|
||||
func (p *DocTableColumn) writeField3(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("is_semantic", thrift.BOOL, 3); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteBool(p.IsSemantic); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err)
|
||||
}
|
||||
func (p *DocTableColumn) writeField4(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("sequence", thrift.I64, 4); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteI64(p.Sequence); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err)
|
||||
}
|
||||
func (p *DocTableColumn) writeField5(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetColumnType() {
|
||||
if err = oprot.WriteFieldBegin("column_type", thrift.I32, 5); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteI32(int32(*p.ColumnType)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err)
|
||||
}
|
||||
func (p *DocTableColumn) writeField6(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetContainsEmptyValue() {
|
||||
if err = oprot.WriteFieldBegin("contains_empty_value", thrift.BOOL, 6); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteBool(*p.ContainsEmptyValue); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err)
|
||||
}
|
||||
func (p *DocTableColumn) writeField7(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetDesc() {
|
||||
if err = oprot.WriteFieldBegin("desc", thrift.STRING, 7); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteString(*p.Desc); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 7 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 7 end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *DocTableColumn) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("DocTableColumn(%+v)", *p)
|
||||
|
||||
}
|
||||
@ -6837,7 +6837,7 @@ type OpenMessageApi struct {
|
||||
//message content
|
||||
Content string `thrift:"content,4" form:"content" json:"content" query:"content"`
|
||||
//session id
|
||||
ConversationID int64 `thrift:"conversation_id,5" form:"conversation_id" json:"conversation_id" query:"conversation_id"`
|
||||
ConversationID int64 `thrift:"conversation_id,5" form:"conversation_id" json:"conversation_id,string" query:"conversation_id"`
|
||||
// custom field
|
||||
MetaData map[string]string `thrift:"meta_data,6" form:"meta_data" json:"meta_data" query:"meta_data"`
|
||||
//creation time
|
||||
@ -6845,7 +6845,7 @@ type OpenMessageApi struct {
|
||||
//update time
|
||||
UpdatedAt int64 `thrift:"updated_at,8" form:"updated_at" json:"updated_at" query:"updated_at"`
|
||||
// ID of a conversation
|
||||
ChatID int64 `thrift:"chat_id,9" form:"chat_id" json:"chat_id" query:"chat_id"`
|
||||
ChatID int64 `thrift:"chat_id,9" form:"chat_id" json:"chat_id,string" query:"chat_id"`
|
||||
// Content type, text/mix
|
||||
ContentType string `thrift:"content_type,10" form:"content_type" json:"content_type" query:"content_type"`
|
||||
//Message Type answer/question/function_call/tool_response
|
||||
|
||||
@ -1,26 +1,42 @@
|
||||
/*
|
||||
* Copyright 2025 coze-dev Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Code generated by thriftgo (0.4.1). DO NOT EDIT.
|
||||
|
||||
package coze
|
||||
|
||||
import (
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/app/bot_open_api"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/app/developer_api"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/app/intelligence"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/conversation/agentrun"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/conversation/conversation"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/conversation/message"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/database"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/data/database"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/data/knowledge"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/data/variable"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/file/upload"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/flow/dataengine/dataset"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/flow/marketplace/product_public_api"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/intelligence"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/bot_open_api"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/developer_api"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/memory"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/playground"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/plugin_develop"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/workflow"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/marketplace/product_public_api"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/passport"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/permission/openapiauth"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/playground"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/plugin_develop"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/resource"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/workflow"
|
||||
)
|
||||
|
||||
type IntelligenceService interface {
|
||||
@ -154,28 +170,28 @@ func NewOpenAPIAuthServiceClient(c thrift.TClient) *OpenAPIAuthServiceClient {
|
||||
}
|
||||
|
||||
type MemoryService interface {
|
||||
memory.MemoryService
|
||||
variable.MemoryService
|
||||
}
|
||||
|
||||
type MemoryServiceClient struct {
|
||||
*memory.MemoryServiceClient
|
||||
*variable.MemoryServiceClient
|
||||
}
|
||||
|
||||
func NewMemoryServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *MemoryServiceClient {
|
||||
return &MemoryServiceClient{
|
||||
MemoryServiceClient: memory.NewMemoryServiceClientFactory(t, f),
|
||||
MemoryServiceClient: variable.NewMemoryServiceClientFactory(t, f),
|
||||
}
|
||||
}
|
||||
|
||||
func NewMemoryServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *MemoryServiceClient {
|
||||
return &MemoryServiceClient{
|
||||
MemoryServiceClient: memory.NewMemoryServiceClientProtocol(t, iprot, oprot),
|
||||
MemoryServiceClient: variable.NewMemoryServiceClientProtocol(t, iprot, oprot),
|
||||
}
|
||||
}
|
||||
|
||||
func NewMemoryServiceClient(c thrift.TClient) *MemoryServiceClient {
|
||||
return &MemoryServiceClient{
|
||||
MemoryServiceClient: memory.NewMemoryServiceClient(c),
|
||||
MemoryServiceClient: variable.NewMemoryServiceClient(c),
|
||||
}
|
||||
}
|
||||
|
||||
@ -388,28 +404,28 @@ func NewWorkflowServiceClient(c thrift.TClient) *WorkflowServiceClient {
|
||||
}
|
||||
|
||||
type KnowledgeService interface {
|
||||
dataset.DatasetService
|
||||
knowledge.DatasetService
|
||||
}
|
||||
|
||||
type KnowledgeServiceClient struct {
|
||||
*dataset.DatasetServiceClient
|
||||
*knowledge.DatasetServiceClient
|
||||
}
|
||||
|
||||
func NewKnowledgeServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *KnowledgeServiceClient {
|
||||
return &KnowledgeServiceClient{
|
||||
DatasetServiceClient: dataset.NewDatasetServiceClientFactory(t, f),
|
||||
DatasetServiceClient: knowledge.NewDatasetServiceClientFactory(t, f),
|
||||
}
|
||||
}
|
||||
|
||||
func NewKnowledgeServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *KnowledgeServiceClient {
|
||||
return &KnowledgeServiceClient{
|
||||
DatasetServiceClient: dataset.NewDatasetServiceClientProtocol(t, iprot, oprot),
|
||||
DatasetServiceClient: knowledge.NewDatasetServiceClientProtocol(t, iprot, oprot),
|
||||
}
|
||||
}
|
||||
|
||||
func NewKnowledgeServiceClient(c thrift.TClient) *KnowledgeServiceClient {
|
||||
return &KnowledgeServiceClient{
|
||||
DatasetServiceClient: dataset.NewDatasetServiceClient(c),
|
||||
DatasetServiceClient: knowledge.NewDatasetServiceClient(c),
|
||||
}
|
||||
}
|
||||
|
||||
@ -511,11 +527,11 @@ func NewOpenAPIAuthServiceProcessor(handler OpenAPIAuthService) *OpenAPIAuthServ
|
||||
}
|
||||
|
||||
type MemoryServiceProcessor struct {
|
||||
*memory.MemoryServiceProcessor
|
||||
*variable.MemoryServiceProcessor
|
||||
}
|
||||
|
||||
func NewMemoryServiceProcessor(handler MemoryService) *MemoryServiceProcessor {
|
||||
self := &MemoryServiceProcessor{memory.NewMemoryServiceProcessor(handler)}
|
||||
self := &MemoryServiceProcessor{variable.NewMemoryServiceProcessor(handler)}
|
||||
return self
|
||||
}
|
||||
|
||||
@ -592,11 +608,11 @@ func NewWorkflowServiceProcessor(handler WorkflowService) *WorkflowServiceProces
|
||||
}
|
||||
|
||||
type KnowledgeServiceProcessor struct {
|
||||
*dataset.DatasetServiceProcessor
|
||||
*knowledge.DatasetServiceProcessor
|
||||
}
|
||||
|
||||
func NewKnowledgeServiceProcessor(handler KnowledgeService) *KnowledgeServiceProcessor {
|
||||
self := &KnowledgeServiceProcessor{dataset.NewDatasetServiceProcessor(handler)}
|
||||
self := &KnowledgeServiceProcessor{knowledge.NewDatasetServiceProcessor(handler)}
|
||||
return self
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
package connector
|
||||
|
||||
import "github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/developer_api"
|
||||
import "github.com/coze-dev/coze-studio/backend/api/model/app/developer_api"
|
||||
|
||||
type Connector struct {
|
||||
ID int64 `json:"id"`
|
||||
|
||||
@ -17,8 +17,8 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/bot_common"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/table"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/app/bot_common"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/data/database/table"
|
||||
)
|
||||
|
||||
type ExecuteSQLRequest struct {
|
||||
@ -204,3 +204,110 @@ type GetAllDatabaseByAppIDRequest struct {
|
||||
type GetAllDatabaseByAppIDResponse struct {
|
||||
Databases []*Database // online databases
|
||||
}
|
||||
|
||||
type SQLParam struct {
|
||||
Value string
|
||||
IsNull bool
|
||||
}
|
||||
type CustomSQLRequest struct {
|
||||
DatabaseInfoID int64
|
||||
SQL string
|
||||
Params []SQLParam
|
||||
IsDebugRun bool
|
||||
UserID string
|
||||
ConnectorID int64
|
||||
}
|
||||
|
||||
type Object = map[string]any
|
||||
|
||||
type Response struct {
|
||||
RowNumber *int64
|
||||
Objects []Object
|
||||
}
|
||||
|
||||
type Operator string
|
||||
type ClauseRelation string
|
||||
|
||||
const (
|
||||
ClauseRelationAND ClauseRelation = "and"
|
||||
ClauseRelationOR ClauseRelation = "or"
|
||||
)
|
||||
|
||||
const (
|
||||
OperatorEqual Operator = "="
|
||||
OperatorNotEqual Operator = "!="
|
||||
OperatorGreater Operator = ">"
|
||||
OperatorLesser Operator = "<"
|
||||
OperatorGreaterOrEqual Operator = ">="
|
||||
OperatorLesserOrEqual Operator = "<="
|
||||
OperatorIn Operator = "in"
|
||||
OperatorNotIn Operator = "not_in"
|
||||
OperatorIsNull Operator = "is_null"
|
||||
OperatorIsNotNull Operator = "is_not_null"
|
||||
OperatorLike Operator = "like"
|
||||
OperatorNotLike Operator = "not_like"
|
||||
)
|
||||
|
||||
type ClauseGroup struct {
|
||||
Single *Clause
|
||||
Multi *MultiClause
|
||||
}
|
||||
type Clause struct {
|
||||
Left string
|
||||
Operator Operator
|
||||
}
|
||||
type MultiClause struct {
|
||||
Clauses []*Clause
|
||||
Relation ClauseRelation
|
||||
}
|
||||
|
||||
type ConditionStr struct {
|
||||
Left string
|
||||
Operator Operator
|
||||
Right any
|
||||
}
|
||||
|
||||
type ConditionGroup struct {
|
||||
Conditions []*ConditionStr
|
||||
Relation ClauseRelation
|
||||
}
|
||||
|
||||
type DeleteRequest struct {
|
||||
DatabaseInfoID int64
|
||||
ConditionGroup *ConditionGroup
|
||||
IsDebugRun bool
|
||||
UserID string
|
||||
ConnectorID int64
|
||||
}
|
||||
|
||||
type QueryRequest struct {
|
||||
DatabaseInfoID int64
|
||||
SelectFields []string
|
||||
Limit int64
|
||||
ConditionGroup *ConditionGroup
|
||||
OrderClauses []*OrderClause
|
||||
IsDebugRun bool
|
||||
UserID string
|
||||
ConnectorID int64
|
||||
}
|
||||
|
||||
type OrderClause struct {
|
||||
FieldID string
|
||||
IsAsc bool
|
||||
}
|
||||
type UpdateRequest struct {
|
||||
DatabaseInfoID int64
|
||||
ConditionGroup *ConditionGroup
|
||||
Fields map[string]any
|
||||
IsDebugRun bool
|
||||
UserID string
|
||||
ConnectorID int64
|
||||
}
|
||||
|
||||
type InsertRequest struct {
|
||||
DatabaseInfoID int64
|
||||
Fields map[string]any
|
||||
IsDebugRun bool
|
||||
UserID string
|
||||
ConnectorID int64
|
||||
}
|
||||
|
||||
@ -23,6 +23,7 @@ import (
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/chatmodel"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/document"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/document/parser"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/lang/ptr"
|
||||
)
|
||||
|
||||
@ -124,6 +125,7 @@ type RetrievalStrategy struct {
|
||||
EnableQueryRewrite bool
|
||||
EnableRerank bool
|
||||
EnableNL2SQL bool
|
||||
IsPersonalOnly bool
|
||||
}
|
||||
|
||||
type SelectType int64
|
||||
@ -283,3 +285,69 @@ type CopyKnowledgeResponse struct {
|
||||
type MoveKnowledgeToLibraryRequest struct {
|
||||
KnowledgeID int64
|
||||
}
|
||||
|
||||
type ParseMode string
|
||||
|
||||
const (
|
||||
FastParseMode = "fast_mode"
|
||||
AccurateParseMode = "accurate_mode"
|
||||
)
|
||||
|
||||
type ChunkType string
|
||||
|
||||
const (
|
||||
ChunkTypeDefault ChunkType = "default"
|
||||
ChunkTypeCustom ChunkType = "custom"
|
||||
ChunkTypeLeveled ChunkType = "leveled"
|
||||
)
|
||||
|
||||
type ParsingStrategy struct {
|
||||
ParseMode ParseMode
|
||||
ExtractImage bool
|
||||
ExtractTable bool
|
||||
ImageOCR bool
|
||||
}
|
||||
type ChunkingStrategy struct {
|
||||
ChunkType ChunkType
|
||||
ChunkSize int64
|
||||
Separator string
|
||||
Overlap int64
|
||||
}
|
||||
|
||||
type CreateDocumentRequest struct {
|
||||
KnowledgeID int64
|
||||
ParsingStrategy *ParsingStrategy
|
||||
ChunkingStrategy *ChunkingStrategy
|
||||
FileURL string
|
||||
FileName string
|
||||
FileExtension parser.FileExtension
|
||||
}
|
||||
type CreateDocumentResponse struct {
|
||||
DocumentID int64
|
||||
FileName string
|
||||
FileURL string
|
||||
}
|
||||
|
||||
type DeleteDocumentRequest struct {
|
||||
DocumentID string
|
||||
}
|
||||
|
||||
type DeleteDocumentResponse struct {
|
||||
IsSuccess bool
|
||||
}
|
||||
|
||||
type KnowledgeDetail struct {
|
||||
ID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
IconURL string `json:"-"`
|
||||
FormatType int64 `json:"-"`
|
||||
}
|
||||
|
||||
type ListKnowledgeDetailRequest struct {
|
||||
KnowledgeIDs []int64
|
||||
}
|
||||
|
||||
type ListKnowledgeDetailResponse struct {
|
||||
KnowledgeDetails []*KnowledgeDetail
|
||||
}
|
||||
|
||||
@ -101,4 +101,7 @@ const (
|
||||
MessageTypeFlowUp MessageType = "follow_up"
|
||||
MessageTypeInterrupt MessageType = "interrupt"
|
||||
MessageTypeVerbose MessageType = "verbose"
|
||||
|
||||
MessageTypeToolAsAnswer MessageType = "tool_as_answer"
|
||||
MessageTypeToolMidAnswer MessageType = "tool_mid_answer"
|
||||
)
|
||||
|
||||
24
backend/api/model/crossdomain/modelmgr/modelmgr.go
Normal file
24
backend/api/model/crossdomain/modelmgr/modelmgr.go
Normal file
@ -0,0 +1,24 @@
|
||||
package model
|
||||
|
||||
type LLMParams struct {
|
||||
ModelName string `json:"modelName"`
|
||||
ModelType int64 `json:"modelType"`
|
||||
Prompt string `json:"prompt"` // user prompt
|
||||
Temperature *float64 `json:"temperature"`
|
||||
FrequencyPenalty float64 `json:"frequencyPenalty"`
|
||||
PresencePenalty float64 `json:"presencePenalty"`
|
||||
MaxTokens int `json:"maxTokens"`
|
||||
TopP *float64 `json:"topP"`
|
||||
TopK *int `json:"topK"`
|
||||
EnableChatHistory bool `json:"enableChatHistory"`
|
||||
SystemPrompt string `json:"systemPrompt"`
|
||||
ResponseFormat ResponseFormat `json:"responseFormat"`
|
||||
}
|
||||
|
||||
type ResponseFormat int64
|
||||
|
||||
const (
|
||||
ResponseFormatText ResponseFormat = 0
|
||||
ResponseFormatMarkdown ResponseFormat = 1
|
||||
ResponseFormatJSON ResponseFormat = 2
|
||||
)
|
||||
@ -77,6 +77,7 @@ type InvalidResponseProcessStrategy int8
|
||||
const (
|
||||
InvalidResponseProcessStrategyOfReturnRaw InvalidResponseProcessStrategy = 0 // If the value of a field is invalid, the raw response value of the field is returned.
|
||||
InvalidResponseProcessStrategyOfReturnDefault InvalidResponseProcessStrategy = 1 // If the value of a field is invalid, the default value of the field is returned.
|
||||
InvalidResponseProcessStrategyOfReturnErr InvalidResponseProcessStrategy = 2 // If the value of a field is invalid, error is returned.
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@ -21,7 +21,7 @@ import (
|
||||
|
||||
"github.com/getkin/kin-openapi/openapi3"
|
||||
|
||||
common "github.com/coze-dev/coze-studio/backend/api/model/plugin_develop_common"
|
||||
common "github.com/coze-dev/coze-studio/backend/api/model/plugin_develop/common"
|
||||
)
|
||||
|
||||
var httpParamLocations = map[common.ParameterLocation]HTTPParamLocation{
|
||||
|
||||
@ -181,6 +181,9 @@ func (op *Openapi3Operation) ToEinoSchemaParameterInfo(ctx context.Context) (map
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if subParam == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
subParams[paramName] = subParam
|
||||
}
|
||||
@ -252,6 +255,9 @@ func (op *Openapi3Operation) ToEinoSchemaParameterInfo(ctx context.Context) (map
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if paramInfo == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
if _, ok := result[paramName]; ok {
|
||||
logs.CtxWarnf(ctx, "duplicate parameter name '%s'", paramName)
|
||||
@ -19,7 +19,7 @@ package plugin
|
||||
import (
|
||||
"github.com/getkin/kin-openapi/openapi3"
|
||||
|
||||
api "github.com/coze-dev/coze-studio/backend/api/model/plugin_develop_common"
|
||||
api "github.com/coze-dev/coze-studio/backend/api/model/plugin_develop/common"
|
||||
)
|
||||
|
||||
type VersionPlugin struct {
|
||||
|
||||
@ -19,10 +19,11 @@ package plugin
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
api "github.com/coze-dev/coze-studio/backend/api/model/plugin_develop_common"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/plugin/utils"
|
||||
api "github.com/coze-dev/coze-studio/backend/api/model/plugin_develop/common"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/plugin/encrypt"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/errorx"
|
||||
"github.com/coze-dev/coze-studio/backend/types/errno"
|
||||
|
||||
@ -74,7 +75,12 @@ func (mf *PluginManifest) EncryptAuthPayload() (*PluginManifest, error) {
|
||||
return mf_, nil
|
||||
}
|
||||
|
||||
payload_, err := utils.EncryptByAES([]byte(mf_.Auth.Payload), utils.AuthSecretKey)
|
||||
secret := os.Getenv(encrypt.AuthSecretEnv)
|
||||
if secret == "" {
|
||||
secret = encrypt.DefaultAuthSecret
|
||||
}
|
||||
|
||||
payload_, err := encrypt.EncryptByAES([]byte(mf_.Auth.Payload), secret)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -357,7 +363,12 @@ func (au *AuthV2) UnmarshalJSON(data []byte) error {
|
||||
}
|
||||
|
||||
if auth.Payload != "" {
|
||||
payload_, err := utils.DecryptByAES(auth.Payload, utils.AuthSecretKey)
|
||||
secret := os.Getenv(encrypt.AuthSecretEnv)
|
||||
if secret == "" {
|
||||
secret = encrypt.DefaultAuthSecret
|
||||
}
|
||||
|
||||
payload_, err := encrypt.DecryptByAES(auth.Payload, secret)
|
||||
if err == nil {
|
||||
auth.Payload = string(payload_)
|
||||
}
|
||||
|
||||
@ -22,14 +22,12 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/getkin/kin-openapi/openapi3"
|
||||
gonanoid "github.com/matoous/go-nanoid"
|
||||
|
||||
productAPI "github.com/coze-dev/coze-studio/backend/api/model/flow/marketplace/product_public_api"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/plugin_develop_common"
|
||||
common "github.com/coze-dev/coze-studio/backend/api/model/plugin_develop_common"
|
||||
productAPI "github.com/coze-dev/coze-studio/backend/api/model/marketplace/product_public_api"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/plugin_develop/common"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/lang/ptr"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/lang/slices"
|
||||
"github.com/getkin/kin-openapi/openapi3"
|
||||
gonanoid "github.com/matoous/go-nanoid"
|
||||
)
|
||||
|
||||
type ToolInfo struct {
|
||||
@ -40,7 +38,7 @@ type ToolInfo struct {
|
||||
Version *string
|
||||
|
||||
ActivatedStatus *ActivatedStatus
|
||||
DebugStatus *plugin_develop_common.APIDebugStatus
|
||||
DebugStatus *common.APIDebugStatus
|
||||
|
||||
Method *string
|
||||
SubURL *string
|
||||
|
||||
75
backend/api/model/crossdomain/plugin/workflow.go
Normal file
75
backend/api/model/crossdomain/plugin/workflow.go
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright 2025 coze-dev Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package plugin
|
||||
|
||||
import (
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/workflow"
|
||||
)
|
||||
|
||||
type ToolsInfoRequest struct {
|
||||
PluginEntity PluginEntity
|
||||
ToolIDs []int64
|
||||
IsDraft bool
|
||||
}
|
||||
|
||||
type PluginEntity struct {
|
||||
PluginID int64
|
||||
PluginVersion *string // nil or "0" means draft, "" means latest/online version, otherwise is specific version
|
||||
}
|
||||
|
||||
type ToolsInfoResponse struct {
|
||||
PluginID int64
|
||||
SpaceID int64
|
||||
Version string
|
||||
PluginName string
|
||||
Description string
|
||||
IconURL string
|
||||
PluginType int64
|
||||
ToolInfoList map[int64]ToolInfoW
|
||||
LatestVersion *string
|
||||
IsOfficial bool
|
||||
AppID int64
|
||||
}
|
||||
|
||||
type ToolInfoW struct {
|
||||
ToolName string
|
||||
ToolID int64
|
||||
Description string
|
||||
DebugExample *DebugExample
|
||||
|
||||
Inputs []*workflow.APIParameter
|
||||
Outputs []*workflow.APIParameter
|
||||
}
|
||||
|
||||
type DebugExample struct {
|
||||
ReqExample string
|
||||
RespExample string
|
||||
}
|
||||
|
||||
type ToolsInvokableRequest struct {
|
||||
PluginEntity PluginEntity
|
||||
ToolsInvokableInfo map[int64]*ToolsInvokableInfo
|
||||
IsDraft bool
|
||||
}
|
||||
|
||||
type WorkflowAPIParameters = []*workflow.APIParameter
|
||||
|
||||
type ToolsInvokableInfo struct {
|
||||
ToolID int64
|
||||
RequestAPIParametersConfig WorkflowAPIParameters
|
||||
ResponseAPIParametersConfig WorkflowAPIParameters
|
||||
}
|
||||
@ -20,10 +20,10 @@ import (
|
||||
"github.com/cloudwego/eino/schema"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/app/bot_common"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/crossdomain/agentrun"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/crossdomain/plugin"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/bot_common"
|
||||
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/crossworkflow"
|
||||
crossworkflow "github.com/coze-dev/coze-studio/backend/crossdomain/contract/workflow"
|
||||
)
|
||||
|
||||
type AgentRuntime struct {
|
||||
@ -37,17 +37,22 @@ type AgentRuntime struct {
|
||||
type EventType string
|
||||
|
||||
const (
|
||||
EventTypeOfChatModelAnswer EventType = "chatmodel_answer"
|
||||
EventTypeOfToolsMessage EventType = "tools_message"
|
||||
EventTypeOfFuncCall EventType = "func_call"
|
||||
EventTypeOfSuggest EventType = "suggest"
|
||||
EventTypeOfKnowledge EventType = "knowledge"
|
||||
EventTypeOfInterrupt EventType = "interrupt"
|
||||
EventTypeOfChatModelAnswer EventType = "chatmodel_answer"
|
||||
EventTypeOfToolsAsChatModelStream EventType = "tools_as_chatmodel_answer"
|
||||
EventTypeOfToolMidAnswer EventType = "tool_mid_answer"
|
||||
EventTypeOfToolsMessage EventType = "tools_message"
|
||||
EventTypeOfFuncCall EventType = "func_call"
|
||||
EventTypeOfSuggest EventType = "suggest"
|
||||
EventTypeOfKnowledge EventType = "knowledge"
|
||||
EventTypeOfInterrupt EventType = "interrupt"
|
||||
)
|
||||
|
||||
type AgentEvent struct {
|
||||
EventType EventType
|
||||
|
||||
ToolMidAnswer *schema.StreamReader[*schema.Message]
|
||||
ToolAsChatModelAnswer *schema.StreamReader[*schema.Message]
|
||||
|
||||
ChatModelAnswer *schema.StreamReader[*schema.Message]
|
||||
ToolsMessage []*schema.Message
|
||||
FuncCall *schema.Message
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
package variables
|
||||
|
||||
import (
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/project_memory"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/data/variable/project_memory"
|
||||
)
|
||||
|
||||
type UserVariableMeta struct {
|
||||
|
||||
@ -14,7 +14,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package vo
|
||||
package workflow
|
||||
|
||||
type Locator uint8
|
||||
|
||||
const (
|
||||
FromDraft Locator = iota
|
||||
FromSpecificVersion
|
||||
FromLatestVersion
|
||||
)
|
||||
|
||||
type ExecuteConfig struct {
|
||||
ID int64
|
||||
@ -6,8 +6,8 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/knowledge/document"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/table"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/data/database/table"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/data/knowledge"
|
||||
)
|
||||
|
||||
type DatabaseService interface {
|
||||
@ -41,7 +41,7 @@ type DatabaseService interface {
|
||||
|
||||
UpdateDatabaseBotSwitch(ctx context.Context, req *table.UpdateDatabaseBotSwitchRequest) (r *table.UpdateDatabaseBotSwitchResponse, err error)
|
||||
|
||||
GetDatabaseTableSchema(ctx context.Context, req *table.GetTableSchemaRequest) (r *document.GetTableSchemaInfoResponse, err error)
|
||||
GetDatabaseTableSchema(ctx context.Context, req *table.GetTableSchemaRequest) (r *knowledge.GetTableSchemaInfoResponse, err error)
|
||||
|
||||
ValidateDatabaseTableSchema(ctx context.Context, req *table.ValidateTableSchemaRequest) (r *table.ValidateTableSchemaResponse, err error)
|
||||
|
||||
@ -211,7 +211,7 @@ func (p *DatabaseServiceClient) UpdateDatabaseBotSwitch(ctx context.Context, req
|
||||
}
|
||||
return _result.GetSuccess(), nil
|
||||
}
|
||||
func (p *DatabaseServiceClient) GetDatabaseTableSchema(ctx context.Context, req *table.GetTableSchemaRequest) (r *document.GetTableSchemaInfoResponse, err error) {
|
||||
func (p *DatabaseServiceClient) GetDatabaseTableSchema(ctx context.Context, req *table.GetTableSchemaRequest) (r *knowledge.GetTableSchemaInfoResponse, err error) {
|
||||
var _args DatabaseServiceGetDatabaseTableSchemaArgs
|
||||
_args.Req = req
|
||||
var _result DatabaseServiceGetDatabaseTableSchemaResult
|
||||
@ -1046,7 +1046,7 @@ func (p *databaseServiceProcessorGetDatabaseTableSchema) Process(ctx context.Con
|
||||
iprot.ReadMessageEnd()
|
||||
var err2 error
|
||||
result := DatabaseServiceGetDatabaseTableSchemaResult{}
|
||||
var retval *document.GetTableSchemaInfoResponse
|
||||
var retval *knowledge.GetTableSchemaInfoResponse
|
||||
if retval, err2 = p.handler.GetDatabaseTableSchema(ctx, args.Req); err2 != nil {
|
||||
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetDatabaseTableSchema: "+err2.Error())
|
||||
oprot.WriteMessageBegin("GetDatabaseTableSchema", thrift.EXCEPTION, seqId)
|
||||
@ -5745,7 +5745,7 @@ func (p *DatabaseServiceGetDatabaseTableSchemaArgs) String() string {
|
||||
}
|
||||
|
||||
type DatabaseServiceGetDatabaseTableSchemaResult struct {
|
||||
Success *document.GetTableSchemaInfoResponse `thrift:"success,0,optional"`
|
||||
Success *knowledge.GetTableSchemaInfoResponse `thrift:"success,0,optional"`
|
||||
}
|
||||
|
||||
func NewDatabaseServiceGetDatabaseTableSchemaResult() *DatabaseServiceGetDatabaseTableSchemaResult {
|
||||
@ -5755,9 +5755,9 @@ func NewDatabaseServiceGetDatabaseTableSchemaResult() *DatabaseServiceGetDatabas
|
||||
func (p *DatabaseServiceGetDatabaseTableSchemaResult) InitDefault() {
|
||||
}
|
||||
|
||||
var DatabaseServiceGetDatabaseTableSchemaResult_Success_DEFAULT *document.GetTableSchemaInfoResponse
|
||||
var DatabaseServiceGetDatabaseTableSchemaResult_Success_DEFAULT *knowledge.GetTableSchemaInfoResponse
|
||||
|
||||
func (p *DatabaseServiceGetDatabaseTableSchemaResult) GetSuccess() (v *document.GetTableSchemaInfoResponse) {
|
||||
func (p *DatabaseServiceGetDatabaseTableSchemaResult) GetSuccess() (v *knowledge.GetTableSchemaInfoResponse) {
|
||||
if !p.IsSetSuccess() {
|
||||
return DatabaseServiceGetDatabaseTableSchemaResult_Success_DEFAULT
|
||||
}
|
||||
@ -5828,7 +5828,7 @@ ReadStructEndError:
|
||||
}
|
||||
|
||||
func (p *DatabaseServiceGetDatabaseTableSchemaResult) ReadField0(iprot thrift.TProtocol) error {
|
||||
_field := document.NewGetTableSchemaInfoResponse()
|
||||
_field := knowledge.NewGetTableSchemaInfoResponse()
|
||||
if err := _field.Read(iprot); err != nil {
|
||||
return err
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
// Code generated by thriftgo (0.4.1). DO NOT EDIT.
|
||||
|
||||
package dataset
|
||||
package knowledge
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
@ -503,6 +503,79 @@ func (p *ReviewStatus) Value() (driver.Value, error) {
|
||||
return int64(*p), nil
|
||||
}
|
||||
|
||||
type ColumnType int64
|
||||
|
||||
const (
|
||||
ColumnType_Unknown ColumnType = 0
|
||||
// Text
|
||||
ColumnType_Text ColumnType = 1
|
||||
// number
|
||||
ColumnType_Number ColumnType = 2
|
||||
// time
|
||||
ColumnType_Date ColumnType = 3
|
||||
// float
|
||||
ColumnType_Float ColumnType = 4
|
||||
// bool
|
||||
ColumnType_Boolean ColumnType = 5
|
||||
// picture
|
||||
ColumnType_Image ColumnType = 6
|
||||
)
|
||||
|
||||
func (p ColumnType) String() string {
|
||||
switch p {
|
||||
case ColumnType_Unknown:
|
||||
return "Unknown"
|
||||
case ColumnType_Text:
|
||||
return "Text"
|
||||
case ColumnType_Number:
|
||||
return "Number"
|
||||
case ColumnType_Date:
|
||||
return "Date"
|
||||
case ColumnType_Float:
|
||||
return "Float"
|
||||
case ColumnType_Boolean:
|
||||
return "Boolean"
|
||||
case ColumnType_Image:
|
||||
return "Image"
|
||||
}
|
||||
return "<UNSET>"
|
||||
}
|
||||
|
||||
func ColumnTypeFromString(s string) (ColumnType, error) {
|
||||
switch s {
|
||||
case "Unknown":
|
||||
return ColumnType_Unknown, nil
|
||||
case "Text":
|
||||
return ColumnType_Text, nil
|
||||
case "Number":
|
||||
return ColumnType_Number, nil
|
||||
case "Date":
|
||||
return ColumnType_Date, nil
|
||||
case "Float":
|
||||
return ColumnType_Float, nil
|
||||
case "Boolean":
|
||||
return ColumnType_Boolean, nil
|
||||
case "Image":
|
||||
return ColumnType_Image, nil
|
||||
}
|
||||
return ColumnType(0), fmt.Errorf("not a valid ColumnType string")
|
||||
}
|
||||
|
||||
func ColumnTypePtr(v ColumnType) *ColumnType { return &v }
|
||||
func (p *ColumnType) Scan(value interface{}) (err error) {
|
||||
var result sql.NullInt64
|
||||
err = result.Scan(value)
|
||||
*p = ColumnType(result.Int64)
|
||||
return
|
||||
}
|
||||
|
||||
func (p *ColumnType) Value() (driver.Value, error) {
|
||||
if p == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return int64(*p), nil
|
||||
}
|
||||
|
||||
type ChunkStrategy struct {
|
||||
// A separator, such as a period
|
||||
Separator string `thrift:"separator,1" form:"separator" json:"separator" query:"separator"`
|
||||
@ -2011,3 +2084,453 @@ func (p *SinkStrategy) String() string {
|
||||
return fmt.Sprintf("SinkStrategy(%+v)", *p)
|
||||
|
||||
}
|
||||
|
||||
// Table column information
|
||||
type DocTableColumn struct {
|
||||
// Column ID
|
||||
ID int64 `thrift:"id,1" form:"id" json:"id,string"`
|
||||
// column_name
|
||||
ColumnName string `thrift:"column_name,2" form:"column_name" json:"column_name" query:"column_name"`
|
||||
// Is it a semantically matched column?
|
||||
IsSemantic bool `thrift:"is_semantic,3" form:"is_semantic" json:"is_semantic" query:"is_semantic"`
|
||||
// List the serial number originally in excel
|
||||
Sequence int64 `thrift:"sequence,4" form:"sequence" json:"sequence,string"`
|
||||
// column type
|
||||
ColumnType *ColumnType `thrift:"column_type,5,optional" form:"column_type" json:"column_type,omitempty" query:"column_type"`
|
||||
ContainsEmptyValue *bool `thrift:"contains_empty_value,6,optional" form:"contains_empty_value" json:"contains_empty_value,omitempty" query:"contains_empty_value"`
|
||||
// describe
|
||||
Desc *string `thrift:"desc,7,optional" form:"desc" json:"desc,omitempty" query:"desc"`
|
||||
}
|
||||
|
||||
func NewDocTableColumn() *DocTableColumn {
|
||||
return &DocTableColumn{}
|
||||
}
|
||||
|
||||
func (p *DocTableColumn) InitDefault() {
|
||||
}
|
||||
|
||||
func (p *DocTableColumn) GetID() (v int64) {
|
||||
return p.ID
|
||||
}
|
||||
|
||||
func (p *DocTableColumn) GetColumnName() (v string) {
|
||||
return p.ColumnName
|
||||
}
|
||||
|
||||
func (p *DocTableColumn) GetIsSemantic() (v bool) {
|
||||
return p.IsSemantic
|
||||
}
|
||||
|
||||
func (p *DocTableColumn) GetSequence() (v int64) {
|
||||
return p.Sequence
|
||||
}
|
||||
|
||||
var DocTableColumn_ColumnType_DEFAULT ColumnType
|
||||
|
||||
func (p *DocTableColumn) GetColumnType() (v ColumnType) {
|
||||
if !p.IsSetColumnType() {
|
||||
return DocTableColumn_ColumnType_DEFAULT
|
||||
}
|
||||
return *p.ColumnType
|
||||
}
|
||||
|
||||
var DocTableColumn_ContainsEmptyValue_DEFAULT bool
|
||||
|
||||
func (p *DocTableColumn) GetContainsEmptyValue() (v bool) {
|
||||
if !p.IsSetContainsEmptyValue() {
|
||||
return DocTableColumn_ContainsEmptyValue_DEFAULT
|
||||
}
|
||||
return *p.ContainsEmptyValue
|
||||
}
|
||||
|
||||
var DocTableColumn_Desc_DEFAULT string
|
||||
|
||||
func (p *DocTableColumn) GetDesc() (v string) {
|
||||
if !p.IsSetDesc() {
|
||||
return DocTableColumn_Desc_DEFAULT
|
||||
}
|
||||
return *p.Desc
|
||||
}
|
||||
|
||||
var fieldIDToName_DocTableColumn = map[int16]string{
|
||||
1: "id",
|
||||
2: "column_name",
|
||||
3: "is_semantic",
|
||||
4: "sequence",
|
||||
5: "column_type",
|
||||
6: "contains_empty_value",
|
||||
7: "desc",
|
||||
}
|
||||
|
||||
func (p *DocTableColumn) IsSetColumnType() bool {
|
||||
return p.ColumnType != nil
|
||||
}
|
||||
|
||||
func (p *DocTableColumn) IsSetContainsEmptyValue() bool {
|
||||
return p.ContainsEmptyValue != nil
|
||||
}
|
||||
|
||||
func (p *DocTableColumn) IsSetDesc() bool {
|
||||
return p.Desc != nil
|
||||
}
|
||||
|
||||
func (p *DocTableColumn) Read(iprot thrift.TProtocol) (err error) {
|
||||
var fieldTypeId thrift.TType
|
||||
var fieldId int16
|
||||
|
||||
if _, err = iprot.ReadStructBegin(); err != nil {
|
||||
goto ReadStructBeginError
|
||||
}
|
||||
|
||||
for {
|
||||
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
||||
if err != nil {
|
||||
goto ReadFieldBeginError
|
||||
}
|
||||
if fieldTypeId == thrift.STOP {
|
||||
break
|
||||
}
|
||||
|
||||
switch fieldId {
|
||||
case 1:
|
||||
if fieldTypeId == thrift.I64 {
|
||||
if err = p.ReadField1(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 2:
|
||||
if fieldTypeId == thrift.STRING {
|
||||
if err = p.ReadField2(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 3:
|
||||
if fieldTypeId == thrift.BOOL {
|
||||
if err = p.ReadField3(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 4:
|
||||
if fieldTypeId == thrift.I64 {
|
||||
if err = p.ReadField4(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 5:
|
||||
if fieldTypeId == thrift.I32 {
|
||||
if err = p.ReadField5(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 6:
|
||||
if fieldTypeId == thrift.BOOL {
|
||||
if err = p.ReadField6(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 7:
|
||||
if fieldTypeId == thrift.STRING {
|
||||
if err = p.ReadField7(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
default:
|
||||
if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadFieldEnd(); err != nil {
|
||||
goto ReadFieldEndError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadStructEnd(); err != nil {
|
||||
goto ReadStructEndError
|
||||
}
|
||||
|
||||
return nil
|
||||
ReadStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
||||
ReadFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
||||
ReadFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_DocTableColumn[fieldId]), err)
|
||||
SkipFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
||||
|
||||
ReadFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
||||
ReadStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *DocTableColumn) ReadField1(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field int64
|
||||
if v, err := iprot.ReadI64(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = v
|
||||
}
|
||||
p.ID = _field
|
||||
return nil
|
||||
}
|
||||
func (p *DocTableColumn) ReadField2(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field string
|
||||
if v, err := iprot.ReadString(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = v
|
||||
}
|
||||
p.ColumnName = _field
|
||||
return nil
|
||||
}
|
||||
func (p *DocTableColumn) ReadField3(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field bool
|
||||
if v, err := iprot.ReadBool(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = v
|
||||
}
|
||||
p.IsSemantic = _field
|
||||
return nil
|
||||
}
|
||||
func (p *DocTableColumn) ReadField4(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field int64
|
||||
if v, err := iprot.ReadI64(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = v
|
||||
}
|
||||
p.Sequence = _field
|
||||
return nil
|
||||
}
|
||||
func (p *DocTableColumn) ReadField5(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field *ColumnType
|
||||
if v, err := iprot.ReadI32(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
tmp := ColumnType(v)
|
||||
_field = &tmp
|
||||
}
|
||||
p.ColumnType = _field
|
||||
return nil
|
||||
}
|
||||
func (p *DocTableColumn) ReadField6(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field *bool
|
||||
if v, err := iprot.ReadBool(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = &v
|
||||
}
|
||||
p.ContainsEmptyValue = _field
|
||||
return nil
|
||||
}
|
||||
func (p *DocTableColumn) ReadField7(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field *string
|
||||
if v, err := iprot.ReadString(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = &v
|
||||
}
|
||||
p.Desc = _field
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *DocTableColumn) Write(oprot thrift.TProtocol) (err error) {
|
||||
var fieldId int16
|
||||
if err = oprot.WriteStructBegin("DocTableColumn"); err != nil {
|
||||
goto WriteStructBeginError
|
||||
}
|
||||
if p != nil {
|
||||
if err = p.writeField1(oprot); err != nil {
|
||||
fieldId = 1
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField2(oprot); err != nil {
|
||||
fieldId = 2
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField3(oprot); err != nil {
|
||||
fieldId = 3
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField4(oprot); err != nil {
|
||||
fieldId = 4
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField5(oprot); err != nil {
|
||||
fieldId = 5
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField6(oprot); err != nil {
|
||||
fieldId = 6
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField7(oprot); err != nil {
|
||||
fieldId = 7
|
||||
goto WriteFieldError
|
||||
}
|
||||
}
|
||||
if err = oprot.WriteFieldStop(); err != nil {
|
||||
goto WriteFieldStopError
|
||||
}
|
||||
if err = oprot.WriteStructEnd(); err != nil {
|
||||
goto WriteStructEndError
|
||||
}
|
||||
return nil
|
||||
WriteStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
||||
WriteFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
||||
WriteFieldStopError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
||||
WriteStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *DocTableColumn) writeField1(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("id", thrift.I64, 1); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteI64(p.ID); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
|
||||
}
|
||||
func (p *DocTableColumn) writeField2(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("column_name", thrift.STRING, 2); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteString(p.ColumnName); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err)
|
||||
}
|
||||
func (p *DocTableColumn) writeField3(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("is_semantic", thrift.BOOL, 3); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteBool(p.IsSemantic); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err)
|
||||
}
|
||||
func (p *DocTableColumn) writeField4(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("sequence", thrift.I64, 4); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteI64(p.Sequence); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err)
|
||||
}
|
||||
func (p *DocTableColumn) writeField5(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetColumnType() {
|
||||
if err = oprot.WriteFieldBegin("column_type", thrift.I32, 5); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteI32(int32(*p.ColumnType)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err)
|
||||
}
|
||||
func (p *DocTableColumn) writeField6(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetContainsEmptyValue() {
|
||||
if err = oprot.WriteFieldBegin("contains_empty_value", thrift.BOOL, 6); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteBool(*p.ContainsEmptyValue); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err)
|
||||
}
|
||||
func (p *DocTableColumn) writeField7(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetDesc() {
|
||||
if err = oprot.WriteFieldBegin("desc", thrift.STRING, 7); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteString(*p.Desc); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 7 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 7 end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *DocTableColumn) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("DocTableColumn(%+v)", *p)
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
// Code generated by thriftgo (0.4.1). DO NOT EDIT.
|
||||
|
||||
package dataset
|
||||
package knowledge
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
@ -5958,3 +5958,825 @@ func (p *GetIconResponse) String() string {
|
||||
return fmt.Sprintf("GetIconResponse(%+v)", *p)
|
||||
|
||||
}
|
||||
|
||||
type GetModeConfigRequest struct {
|
||||
// bot id
|
||||
BotID int64 `thrift:"bot_id,1,required" form:"bot_id,required" json:"bot_id,required" query:"bot_id,required"`
|
||||
// line of business id
|
||||
ConnectorID *int64 `thrift:"connector_id,2,optional" form:"connector_id" json:"connector_id,omitempty" query:"connector_id"`
|
||||
// line of business user id
|
||||
ConnectorUID *string `thrift:"connector_uid,3,optional" form:"connector_uid" json:"connector_uid,omitempty" query:"connector_uid"`
|
||||
Base *base.Base `thrift:"Base,255,optional" form:"Base" json:"Base,omitempty" query:"Base"`
|
||||
}
|
||||
|
||||
func NewGetModeConfigRequest() *GetModeConfigRequest {
|
||||
return &GetModeConfigRequest{}
|
||||
}
|
||||
|
||||
func (p *GetModeConfigRequest) InitDefault() {
|
||||
}
|
||||
|
||||
func (p *GetModeConfigRequest) GetBotID() (v int64) {
|
||||
return p.BotID
|
||||
}
|
||||
|
||||
var GetModeConfigRequest_ConnectorID_DEFAULT int64
|
||||
|
||||
func (p *GetModeConfigRequest) GetConnectorID() (v int64) {
|
||||
if !p.IsSetConnectorID() {
|
||||
return GetModeConfigRequest_ConnectorID_DEFAULT
|
||||
}
|
||||
return *p.ConnectorID
|
||||
}
|
||||
|
||||
var GetModeConfigRequest_ConnectorUID_DEFAULT string
|
||||
|
||||
func (p *GetModeConfigRequest) GetConnectorUID() (v string) {
|
||||
if !p.IsSetConnectorUID() {
|
||||
return GetModeConfigRequest_ConnectorUID_DEFAULT
|
||||
}
|
||||
return *p.ConnectorUID
|
||||
}
|
||||
|
||||
var GetModeConfigRequest_Base_DEFAULT *base.Base
|
||||
|
||||
func (p *GetModeConfigRequest) GetBase() (v *base.Base) {
|
||||
if !p.IsSetBase() {
|
||||
return GetModeConfigRequest_Base_DEFAULT
|
||||
}
|
||||
return p.Base
|
||||
}
|
||||
|
||||
var fieldIDToName_GetModeConfigRequest = map[int16]string{
|
||||
1: "bot_id",
|
||||
2: "connector_id",
|
||||
3: "connector_uid",
|
||||
255: "Base",
|
||||
}
|
||||
|
||||
func (p *GetModeConfigRequest) IsSetConnectorID() bool {
|
||||
return p.ConnectorID != nil
|
||||
}
|
||||
|
||||
func (p *GetModeConfigRequest) IsSetConnectorUID() bool {
|
||||
return p.ConnectorUID != nil
|
||||
}
|
||||
|
||||
func (p *GetModeConfigRequest) IsSetBase() bool {
|
||||
return p.Base != nil
|
||||
}
|
||||
|
||||
func (p *GetModeConfigRequest) Read(iprot thrift.TProtocol) (err error) {
|
||||
var fieldTypeId thrift.TType
|
||||
var fieldId int16
|
||||
var issetBotID bool = false
|
||||
|
||||
if _, err = iprot.ReadStructBegin(); err != nil {
|
||||
goto ReadStructBeginError
|
||||
}
|
||||
|
||||
for {
|
||||
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
||||
if err != nil {
|
||||
goto ReadFieldBeginError
|
||||
}
|
||||
if fieldTypeId == thrift.STOP {
|
||||
break
|
||||
}
|
||||
|
||||
switch fieldId {
|
||||
case 1:
|
||||
if fieldTypeId == thrift.I64 {
|
||||
if err = p.ReadField1(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
issetBotID = true
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 2:
|
||||
if fieldTypeId == thrift.I64 {
|
||||
if err = p.ReadField2(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 3:
|
||||
if fieldTypeId == thrift.STRING {
|
||||
if err = p.ReadField3(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 255:
|
||||
if fieldTypeId == thrift.STRUCT {
|
||||
if err = p.ReadField255(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
default:
|
||||
if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadFieldEnd(); err != nil {
|
||||
goto ReadFieldEndError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadStructEnd(); err != nil {
|
||||
goto ReadStructEndError
|
||||
}
|
||||
|
||||
if !issetBotID {
|
||||
fieldId = 1
|
||||
goto RequiredFieldNotSetError
|
||||
}
|
||||
return nil
|
||||
ReadStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
||||
ReadFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
||||
ReadFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_GetModeConfigRequest[fieldId]), err)
|
||||
SkipFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
||||
|
||||
ReadFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
||||
ReadStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
||||
RequiredFieldNotSetError:
|
||||
return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_GetModeConfigRequest[fieldId]))
|
||||
}
|
||||
|
||||
func (p *GetModeConfigRequest) ReadField1(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field int64
|
||||
if v, err := iprot.ReadI64(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = v
|
||||
}
|
||||
p.BotID = _field
|
||||
return nil
|
||||
}
|
||||
func (p *GetModeConfigRequest) ReadField2(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field *int64
|
||||
if v, err := iprot.ReadI64(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = &v
|
||||
}
|
||||
p.ConnectorID = _field
|
||||
return nil
|
||||
}
|
||||
func (p *GetModeConfigRequest) ReadField3(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field *string
|
||||
if v, err := iprot.ReadString(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = &v
|
||||
}
|
||||
p.ConnectorUID = _field
|
||||
return nil
|
||||
}
|
||||
func (p *GetModeConfigRequest) ReadField255(iprot thrift.TProtocol) error {
|
||||
_field := base.NewBase()
|
||||
if err := _field.Read(iprot); err != nil {
|
||||
return err
|
||||
}
|
||||
p.Base = _field
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *GetModeConfigRequest) Write(oprot thrift.TProtocol) (err error) {
|
||||
var fieldId int16
|
||||
if err = oprot.WriteStructBegin("GetModeConfigRequest"); err != nil {
|
||||
goto WriteStructBeginError
|
||||
}
|
||||
if p != nil {
|
||||
if err = p.writeField1(oprot); err != nil {
|
||||
fieldId = 1
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField2(oprot); err != nil {
|
||||
fieldId = 2
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField3(oprot); err != nil {
|
||||
fieldId = 3
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField255(oprot); err != nil {
|
||||
fieldId = 255
|
||||
goto WriteFieldError
|
||||
}
|
||||
}
|
||||
if err = oprot.WriteFieldStop(); err != nil {
|
||||
goto WriteFieldStopError
|
||||
}
|
||||
if err = oprot.WriteStructEnd(); err != nil {
|
||||
goto WriteStructEndError
|
||||
}
|
||||
return nil
|
||||
WriteStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
||||
WriteFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
||||
WriteFieldStopError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
||||
WriteStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *GetModeConfigRequest) writeField1(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("bot_id", thrift.I64, 1); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteI64(p.BotID); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
|
||||
}
|
||||
func (p *GetModeConfigRequest) writeField2(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetConnectorID() {
|
||||
if err = oprot.WriteFieldBegin("connector_id", thrift.I64, 2); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteI64(*p.ConnectorID); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err)
|
||||
}
|
||||
func (p *GetModeConfigRequest) writeField3(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetConnectorUID() {
|
||||
if err = oprot.WriteFieldBegin("connector_uid", thrift.STRING, 3); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteString(*p.ConnectorUID); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err)
|
||||
}
|
||||
func (p *GetModeConfigRequest) writeField255(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetBase() {
|
||||
if err = oprot.WriteFieldBegin("Base", thrift.STRUCT, 255); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := p.Base.Write(oprot); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 255 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 255 end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *GetModeConfigRequest) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("GetModeConfigRequest(%+v)", *p)
|
||||
|
||||
}
|
||||
|
||||
type GetModeConfigResponse struct {
|
||||
Code int32 `thrift:"code,1" form:"code" json:"code" query:"code"`
|
||||
Msg string `thrift:"msg,2" form:"msg" json:"msg" query:"msg"`
|
||||
Mode string `thrift:"mode,3" form:"mode" json:"mode" query:"mode"`
|
||||
BotID int64 `thrift:"bot_id,4" form:"bot_id" json:"bot_id" query:"bot_id"`
|
||||
MaxTableNum int64 `thrift:"max_table_num,5" form:"max_table_num" json:"max_table_num" query:"max_table_num"`
|
||||
MaxColumnNum int64 `thrift:"max_column_num,6" form:"max_column_num" json:"max_column_num" query:"max_column_num"`
|
||||
MaxCapacityKb int64 `thrift:"max_capacity_kb,7" form:"max_capacity_kb" json:"max_capacity_kb" query:"max_capacity_kb"`
|
||||
MaxRowNum int64 `thrift:"max_row_num,8" form:"max_row_num" json:"max_row_num" query:"max_row_num"`
|
||||
BaseResp *base.BaseResp `thrift:"BaseResp,255,optional" form:"BaseResp" json:"BaseResp,omitempty" query:"BaseResp"`
|
||||
}
|
||||
|
||||
func NewGetModeConfigResponse() *GetModeConfigResponse {
|
||||
return &GetModeConfigResponse{}
|
||||
}
|
||||
|
||||
func (p *GetModeConfigResponse) InitDefault() {
|
||||
}
|
||||
|
||||
func (p *GetModeConfigResponse) GetCode() (v int32) {
|
||||
return p.Code
|
||||
}
|
||||
|
||||
func (p *GetModeConfigResponse) GetMsg() (v string) {
|
||||
return p.Msg
|
||||
}
|
||||
|
||||
func (p *GetModeConfigResponse) GetMode() (v string) {
|
||||
return p.Mode
|
||||
}
|
||||
|
||||
func (p *GetModeConfigResponse) GetBotID() (v int64) {
|
||||
return p.BotID
|
||||
}
|
||||
|
||||
func (p *GetModeConfigResponse) GetMaxTableNum() (v int64) {
|
||||
return p.MaxTableNum
|
||||
}
|
||||
|
||||
func (p *GetModeConfigResponse) GetMaxColumnNum() (v int64) {
|
||||
return p.MaxColumnNum
|
||||
}
|
||||
|
||||
func (p *GetModeConfigResponse) GetMaxCapacityKb() (v int64) {
|
||||
return p.MaxCapacityKb
|
||||
}
|
||||
|
||||
func (p *GetModeConfigResponse) GetMaxRowNum() (v int64) {
|
||||
return p.MaxRowNum
|
||||
}
|
||||
|
||||
var GetModeConfigResponse_BaseResp_DEFAULT *base.BaseResp
|
||||
|
||||
func (p *GetModeConfigResponse) GetBaseResp() (v *base.BaseResp) {
|
||||
if !p.IsSetBaseResp() {
|
||||
return GetModeConfigResponse_BaseResp_DEFAULT
|
||||
}
|
||||
return p.BaseResp
|
||||
}
|
||||
|
||||
var fieldIDToName_GetModeConfigResponse = map[int16]string{
|
||||
1: "code",
|
||||
2: "msg",
|
||||
3: "mode",
|
||||
4: "bot_id",
|
||||
5: "max_table_num",
|
||||
6: "max_column_num",
|
||||
7: "max_capacity_kb",
|
||||
8: "max_row_num",
|
||||
255: "BaseResp",
|
||||
}
|
||||
|
||||
func (p *GetModeConfigResponse) IsSetBaseResp() bool {
|
||||
return p.BaseResp != nil
|
||||
}
|
||||
|
||||
func (p *GetModeConfigResponse) Read(iprot thrift.TProtocol) (err error) {
|
||||
var fieldTypeId thrift.TType
|
||||
var fieldId int16
|
||||
|
||||
if _, err = iprot.ReadStructBegin(); err != nil {
|
||||
goto ReadStructBeginError
|
||||
}
|
||||
|
||||
for {
|
||||
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
||||
if err != nil {
|
||||
goto ReadFieldBeginError
|
||||
}
|
||||
if fieldTypeId == thrift.STOP {
|
||||
break
|
||||
}
|
||||
|
||||
switch fieldId {
|
||||
case 1:
|
||||
if fieldTypeId == thrift.I32 {
|
||||
if err = p.ReadField1(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 2:
|
||||
if fieldTypeId == thrift.STRING {
|
||||
if err = p.ReadField2(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 3:
|
||||
if fieldTypeId == thrift.STRING {
|
||||
if err = p.ReadField3(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 4:
|
||||
if fieldTypeId == thrift.I64 {
|
||||
if err = p.ReadField4(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 5:
|
||||
if fieldTypeId == thrift.I64 {
|
||||
if err = p.ReadField5(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 6:
|
||||
if fieldTypeId == thrift.I64 {
|
||||
if err = p.ReadField6(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 7:
|
||||
if fieldTypeId == thrift.I64 {
|
||||
if err = p.ReadField7(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 8:
|
||||
if fieldTypeId == thrift.I64 {
|
||||
if err = p.ReadField8(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 255:
|
||||
if fieldTypeId == thrift.STRUCT {
|
||||
if err = p.ReadField255(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
default:
|
||||
if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadFieldEnd(); err != nil {
|
||||
goto ReadFieldEndError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadStructEnd(); err != nil {
|
||||
goto ReadStructEndError
|
||||
}
|
||||
|
||||
return nil
|
||||
ReadStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
||||
ReadFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
||||
ReadFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_GetModeConfigResponse[fieldId]), err)
|
||||
SkipFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
||||
|
||||
ReadFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
||||
ReadStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *GetModeConfigResponse) ReadField1(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field int32
|
||||
if v, err := iprot.ReadI32(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = v
|
||||
}
|
||||
p.Code = _field
|
||||
return nil
|
||||
}
|
||||
func (p *GetModeConfigResponse) ReadField2(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field string
|
||||
if v, err := iprot.ReadString(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = v
|
||||
}
|
||||
p.Msg = _field
|
||||
return nil
|
||||
}
|
||||
func (p *GetModeConfigResponse) ReadField3(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field string
|
||||
if v, err := iprot.ReadString(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = v
|
||||
}
|
||||
p.Mode = _field
|
||||
return nil
|
||||
}
|
||||
func (p *GetModeConfigResponse) ReadField4(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field int64
|
||||
if v, err := iprot.ReadI64(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = v
|
||||
}
|
||||
p.BotID = _field
|
||||
return nil
|
||||
}
|
||||
func (p *GetModeConfigResponse) ReadField5(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field int64
|
||||
if v, err := iprot.ReadI64(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = v
|
||||
}
|
||||
p.MaxTableNum = _field
|
||||
return nil
|
||||
}
|
||||
func (p *GetModeConfigResponse) ReadField6(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field int64
|
||||
if v, err := iprot.ReadI64(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = v
|
||||
}
|
||||
p.MaxColumnNum = _field
|
||||
return nil
|
||||
}
|
||||
func (p *GetModeConfigResponse) ReadField7(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field int64
|
||||
if v, err := iprot.ReadI64(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = v
|
||||
}
|
||||
p.MaxCapacityKb = _field
|
||||
return nil
|
||||
}
|
||||
func (p *GetModeConfigResponse) ReadField8(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field int64
|
||||
if v, err := iprot.ReadI64(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = v
|
||||
}
|
||||
p.MaxRowNum = _field
|
||||
return nil
|
||||
}
|
||||
func (p *GetModeConfigResponse) ReadField255(iprot thrift.TProtocol) error {
|
||||
_field := base.NewBaseResp()
|
||||
if err := _field.Read(iprot); err != nil {
|
||||
return err
|
||||
}
|
||||
p.BaseResp = _field
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *GetModeConfigResponse) Write(oprot thrift.TProtocol) (err error) {
|
||||
var fieldId int16
|
||||
if err = oprot.WriteStructBegin("GetModeConfigResponse"); err != nil {
|
||||
goto WriteStructBeginError
|
||||
}
|
||||
if p != nil {
|
||||
if err = p.writeField1(oprot); err != nil {
|
||||
fieldId = 1
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField2(oprot); err != nil {
|
||||
fieldId = 2
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField3(oprot); err != nil {
|
||||
fieldId = 3
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField4(oprot); err != nil {
|
||||
fieldId = 4
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField5(oprot); err != nil {
|
||||
fieldId = 5
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField6(oprot); err != nil {
|
||||
fieldId = 6
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField7(oprot); err != nil {
|
||||
fieldId = 7
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField8(oprot); err != nil {
|
||||
fieldId = 8
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField255(oprot); err != nil {
|
||||
fieldId = 255
|
||||
goto WriteFieldError
|
||||
}
|
||||
}
|
||||
if err = oprot.WriteFieldStop(); err != nil {
|
||||
goto WriteFieldStopError
|
||||
}
|
||||
if err = oprot.WriteStructEnd(); err != nil {
|
||||
goto WriteStructEndError
|
||||
}
|
||||
return nil
|
||||
WriteStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
||||
WriteFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
||||
WriteFieldStopError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
||||
WriteStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *GetModeConfigResponse) writeField1(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("code", thrift.I32, 1); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteI32(p.Code); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
|
||||
}
|
||||
func (p *GetModeConfigResponse) writeField2(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("msg", thrift.STRING, 2); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteString(p.Msg); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err)
|
||||
}
|
||||
func (p *GetModeConfigResponse) writeField3(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("mode", thrift.STRING, 3); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteString(p.Mode); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err)
|
||||
}
|
||||
func (p *GetModeConfigResponse) writeField4(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("bot_id", thrift.I64, 4); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteI64(p.BotID); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err)
|
||||
}
|
||||
func (p *GetModeConfigResponse) writeField5(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("max_table_num", thrift.I64, 5); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteI64(p.MaxTableNum); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err)
|
||||
}
|
||||
func (p *GetModeConfigResponse) writeField6(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("max_column_num", thrift.I64, 6); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteI64(p.MaxColumnNum); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err)
|
||||
}
|
||||
func (p *GetModeConfigResponse) writeField7(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("max_capacity_kb", thrift.I64, 7); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteI64(p.MaxCapacityKb); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 7 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 7 end error: ", p), err)
|
||||
}
|
||||
func (p *GetModeConfigResponse) writeField8(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("max_row_num", thrift.I64, 8); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteI64(p.MaxRowNum); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 8 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 8 end error: ", p), err)
|
||||
}
|
||||
func (p *GetModeConfigResponse) writeField255(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetBaseResp() {
|
||||
if err = oprot.WriteFieldBegin("BaseResp", thrift.STRUCT, 255); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := p.BaseResp.Write(oprot); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 255 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 255 end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *GetModeConfigResponse) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("GetModeConfigResponse(%+v)", *p)
|
||||
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
// Code generated by thriftgo (0.4.1). DO NOT EDIT.
|
||||
|
||||
package dataset
|
||||
package knowledge
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -21,6 +21,8 @@ type DatasetService interface {
|
||||
DeleteDataset(ctx context.Context, req *DeleteDatasetRequest) (r *DeleteDatasetResponse, err error)
|
||||
|
||||
UpdateDataset(ctx context.Context, req *UpdateDatasetRequest) (r *UpdateDatasetResponse, err error)
|
||||
|
||||
GetModeConfig(ctx context.Context, req *GetModeConfigRequest) (r *GetModeConfigResponse, err error)
|
||||
// Document related
|
||||
CreateDocument(ctx context.Context, req *CreateDocumentRequest) (r *CreateDocumentResponse, err error)
|
||||
|
||||
@ -45,6 +47,8 @@ type DatasetService interface {
|
||||
GetTableSchema(ctx context.Context, req *GetTableSchemaRequest) (r *GetTableSchemaResponse, err error)
|
||||
|
||||
ValidateTableSchema(ctx context.Context, req *ValidateTableSchemaRequest) (r *ValidateTableSchemaResponse, err error)
|
||||
|
||||
GetDocumentTableInfo(ctx context.Context, req *GetDocumentTableInfoRequest) (r *GetDocumentTableInfoResponse, err error)
|
||||
// Slice related
|
||||
DeleteSlice(ctx context.Context, req *DeleteSliceRequest) (r *DeleteSliceResponse, err error)
|
||||
|
||||
@ -141,6 +145,15 @@ func (p *DatasetServiceClient) UpdateDataset(ctx context.Context, req *UpdateDat
|
||||
}
|
||||
return _result.GetSuccess(), nil
|
||||
}
|
||||
func (p *DatasetServiceClient) GetModeConfig(ctx context.Context, req *GetModeConfigRequest) (r *GetModeConfigResponse, err error) {
|
||||
var _args DatasetServiceGetModeConfigArgs
|
||||
_args.Req = req
|
||||
var _result DatasetServiceGetModeConfigResult
|
||||
if err = p.Client_().Call(ctx, "GetModeConfig", &_args, &_result); err != nil {
|
||||
return
|
||||
}
|
||||
return _result.GetSuccess(), nil
|
||||
}
|
||||
func (p *DatasetServiceClient) CreateDocument(ctx context.Context, req *CreateDocumentRequest) (r *CreateDocumentResponse, err error) {
|
||||
var _args DatasetServiceCreateDocumentArgs
|
||||
_args.Req = req
|
||||
@ -249,6 +262,15 @@ func (p *DatasetServiceClient) ValidateTableSchema(ctx context.Context, req *Val
|
||||
}
|
||||
return _result.GetSuccess(), nil
|
||||
}
|
||||
func (p *DatasetServiceClient) GetDocumentTableInfo(ctx context.Context, req *GetDocumentTableInfoRequest) (r *GetDocumentTableInfoResponse, err error) {
|
||||
var _args DatasetServiceGetDocumentTableInfoArgs
|
||||
_args.Req = req
|
||||
var _result DatasetServiceGetDocumentTableInfoResult
|
||||
if err = p.Client_().Call(ctx, "GetDocumentTableInfo", &_args, &_result); err != nil {
|
||||
return
|
||||
}
|
||||
return _result.GetSuccess(), nil
|
||||
}
|
||||
func (p *DatasetServiceClient) DeleteSlice(ctx context.Context, req *DeleteSliceRequest) (r *DeleteSliceResponse, err error) {
|
||||
var _args DatasetServiceDeleteSliceArgs
|
||||
_args.Req = req
|
||||
@ -339,6 +361,7 @@ func NewDatasetServiceProcessor(handler DatasetService) *DatasetServiceProcessor
|
||||
self.AddToProcessorMap("ListDataset", &datasetServiceProcessorListDataset{handler: handler})
|
||||
self.AddToProcessorMap("DeleteDataset", &datasetServiceProcessorDeleteDataset{handler: handler})
|
||||
self.AddToProcessorMap("UpdateDataset", &datasetServiceProcessorUpdateDataset{handler: handler})
|
||||
self.AddToProcessorMap("GetModeConfig", &datasetServiceProcessorGetModeConfig{handler: handler})
|
||||
self.AddToProcessorMap("CreateDocument", &datasetServiceProcessorCreateDocument{handler: handler})
|
||||
self.AddToProcessorMap("ListDocument", &datasetServiceProcessorListDocument{handler: handler})
|
||||
self.AddToProcessorMap("DeleteDocument", &datasetServiceProcessorDeleteDocument{handler: handler})
|
||||
@ -351,6 +374,7 @@ func NewDatasetServiceProcessor(handler DatasetService) *DatasetServiceProcessor
|
||||
self.AddToProcessorMap("ExtractPhotoCaption", &datasetServiceProcessorExtractPhotoCaption{handler: handler})
|
||||
self.AddToProcessorMap("GetTableSchema", &datasetServiceProcessorGetTableSchema{handler: handler})
|
||||
self.AddToProcessorMap("ValidateTableSchema", &datasetServiceProcessorValidateTableSchema{handler: handler})
|
||||
self.AddToProcessorMap("GetDocumentTableInfo", &datasetServiceProcessorGetDocumentTableInfo{handler: handler})
|
||||
self.AddToProcessorMap("DeleteSlice", &datasetServiceProcessorDeleteSlice{handler: handler})
|
||||
self.AddToProcessorMap("CreateSlice", &datasetServiceProcessorCreateSlice{handler: handler})
|
||||
self.AddToProcessorMap("UpdateSlice", &datasetServiceProcessorUpdateSlice{handler: handler})
|
||||
@ -666,6 +690,54 @@ func (p *datasetServiceProcessorUpdateDataset) Process(ctx context.Context, seqI
|
||||
return true, err
|
||||
}
|
||||
|
||||
type datasetServiceProcessorGetModeConfig struct {
|
||||
handler DatasetService
|
||||
}
|
||||
|
||||
func (p *datasetServiceProcessorGetModeConfig) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
|
||||
args := DatasetServiceGetModeConfigArgs{}
|
||||
if err = args.Read(iprot); err != nil {
|
||||
iprot.ReadMessageEnd()
|
||||
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
|
||||
oprot.WriteMessageBegin("GetModeConfig", thrift.EXCEPTION, seqId)
|
||||
x.Write(oprot)
|
||||
oprot.WriteMessageEnd()
|
||||
oprot.Flush(ctx)
|
||||
return false, err
|
||||
}
|
||||
|
||||
iprot.ReadMessageEnd()
|
||||
var err2 error
|
||||
result := DatasetServiceGetModeConfigResult{}
|
||||
var retval *GetModeConfigResponse
|
||||
if retval, err2 = p.handler.GetModeConfig(ctx, args.Req); err2 != nil {
|
||||
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetModeConfig: "+err2.Error())
|
||||
oprot.WriteMessageBegin("GetModeConfig", thrift.EXCEPTION, seqId)
|
||||
x.Write(oprot)
|
||||
oprot.WriteMessageEnd()
|
||||
oprot.Flush(ctx)
|
||||
return true, err2
|
||||
} else {
|
||||
result.Success = retval
|
||||
}
|
||||
if err2 = oprot.WriteMessageBegin("GetModeConfig", thrift.REPLY, seqId); err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err2 = result.Write(oprot); err == nil && err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return true, err
|
||||
}
|
||||
|
||||
type datasetServiceProcessorCreateDocument struct {
|
||||
handler DatasetService
|
||||
}
|
||||
@ -1242,6 +1314,54 @@ func (p *datasetServiceProcessorValidateTableSchema) Process(ctx context.Context
|
||||
return true, err
|
||||
}
|
||||
|
||||
type datasetServiceProcessorGetDocumentTableInfo struct {
|
||||
handler DatasetService
|
||||
}
|
||||
|
||||
func (p *datasetServiceProcessorGetDocumentTableInfo) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
|
||||
args := DatasetServiceGetDocumentTableInfoArgs{}
|
||||
if err = args.Read(iprot); err != nil {
|
||||
iprot.ReadMessageEnd()
|
||||
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
|
||||
oprot.WriteMessageBegin("GetDocumentTableInfo", thrift.EXCEPTION, seqId)
|
||||
x.Write(oprot)
|
||||
oprot.WriteMessageEnd()
|
||||
oprot.Flush(ctx)
|
||||
return false, err
|
||||
}
|
||||
|
||||
iprot.ReadMessageEnd()
|
||||
var err2 error
|
||||
result := DatasetServiceGetDocumentTableInfoResult{}
|
||||
var retval *GetDocumentTableInfoResponse
|
||||
if retval, err2 = p.handler.GetDocumentTableInfo(ctx, args.Req); err2 != nil {
|
||||
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetDocumentTableInfo: "+err2.Error())
|
||||
oprot.WriteMessageBegin("GetDocumentTableInfo", thrift.EXCEPTION, seqId)
|
||||
x.Write(oprot)
|
||||
oprot.WriteMessageEnd()
|
||||
oprot.Flush(ctx)
|
||||
return true, err2
|
||||
} else {
|
||||
result.Success = retval
|
||||
}
|
||||
if err2 = oprot.WriteMessageBegin("GetDocumentTableInfo", thrift.REPLY, seqId); err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err2 = result.Write(oprot); err == nil && err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return true, err
|
||||
}
|
||||
|
||||
type datasetServiceProcessorDeleteSlice struct {
|
||||
handler DatasetService
|
||||
}
|
||||
@ -3330,6 +3450,298 @@ func (p *DatasetServiceUpdateDatasetResult) String() string {
|
||||
|
||||
}
|
||||
|
||||
type DatasetServiceGetModeConfigArgs struct {
|
||||
Req *GetModeConfigRequest `thrift:"req,1"`
|
||||
}
|
||||
|
||||
func NewDatasetServiceGetModeConfigArgs() *DatasetServiceGetModeConfigArgs {
|
||||
return &DatasetServiceGetModeConfigArgs{}
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetModeConfigArgs) InitDefault() {
|
||||
}
|
||||
|
||||
var DatasetServiceGetModeConfigArgs_Req_DEFAULT *GetModeConfigRequest
|
||||
|
||||
func (p *DatasetServiceGetModeConfigArgs) GetReq() (v *GetModeConfigRequest) {
|
||||
if !p.IsSetReq() {
|
||||
return DatasetServiceGetModeConfigArgs_Req_DEFAULT
|
||||
}
|
||||
return p.Req
|
||||
}
|
||||
|
||||
var fieldIDToName_DatasetServiceGetModeConfigArgs = map[int16]string{
|
||||
1: "req",
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetModeConfigArgs) IsSetReq() bool {
|
||||
return p.Req != nil
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetModeConfigArgs) Read(iprot thrift.TProtocol) (err error) {
|
||||
var fieldTypeId thrift.TType
|
||||
var fieldId int16
|
||||
|
||||
if _, err = iprot.ReadStructBegin(); err != nil {
|
||||
goto ReadStructBeginError
|
||||
}
|
||||
|
||||
for {
|
||||
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
||||
if err != nil {
|
||||
goto ReadFieldBeginError
|
||||
}
|
||||
if fieldTypeId == thrift.STOP {
|
||||
break
|
||||
}
|
||||
|
||||
switch fieldId {
|
||||
case 1:
|
||||
if fieldTypeId == thrift.STRUCT {
|
||||
if err = p.ReadField1(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
default:
|
||||
if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadFieldEnd(); err != nil {
|
||||
goto ReadFieldEndError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadStructEnd(); err != nil {
|
||||
goto ReadStructEndError
|
||||
}
|
||||
|
||||
return nil
|
||||
ReadStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
||||
ReadFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
||||
ReadFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_DatasetServiceGetModeConfigArgs[fieldId]), err)
|
||||
SkipFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
||||
|
||||
ReadFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
||||
ReadStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetModeConfigArgs) ReadField1(iprot thrift.TProtocol) error {
|
||||
_field := NewGetModeConfigRequest()
|
||||
if err := _field.Read(iprot); err != nil {
|
||||
return err
|
||||
}
|
||||
p.Req = _field
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetModeConfigArgs) Write(oprot thrift.TProtocol) (err error) {
|
||||
var fieldId int16
|
||||
if err = oprot.WriteStructBegin("GetModeConfig_args"); err != nil {
|
||||
goto WriteStructBeginError
|
||||
}
|
||||
if p != nil {
|
||||
if err = p.writeField1(oprot); err != nil {
|
||||
fieldId = 1
|
||||
goto WriteFieldError
|
||||
}
|
||||
}
|
||||
if err = oprot.WriteFieldStop(); err != nil {
|
||||
goto WriteFieldStopError
|
||||
}
|
||||
if err = oprot.WriteStructEnd(); err != nil {
|
||||
goto WriteStructEndError
|
||||
}
|
||||
return nil
|
||||
WriteStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
||||
WriteFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
||||
WriteFieldStopError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
||||
WriteStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetModeConfigArgs) writeField1(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := p.Req.Write(oprot); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetModeConfigArgs) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("DatasetServiceGetModeConfigArgs(%+v)", *p)
|
||||
|
||||
}
|
||||
|
||||
type DatasetServiceGetModeConfigResult struct {
|
||||
Success *GetModeConfigResponse `thrift:"success,0,optional"`
|
||||
}
|
||||
|
||||
func NewDatasetServiceGetModeConfigResult() *DatasetServiceGetModeConfigResult {
|
||||
return &DatasetServiceGetModeConfigResult{}
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetModeConfigResult) InitDefault() {
|
||||
}
|
||||
|
||||
var DatasetServiceGetModeConfigResult_Success_DEFAULT *GetModeConfigResponse
|
||||
|
||||
func (p *DatasetServiceGetModeConfigResult) GetSuccess() (v *GetModeConfigResponse) {
|
||||
if !p.IsSetSuccess() {
|
||||
return DatasetServiceGetModeConfigResult_Success_DEFAULT
|
||||
}
|
||||
return p.Success
|
||||
}
|
||||
|
||||
var fieldIDToName_DatasetServiceGetModeConfigResult = map[int16]string{
|
||||
0: "success",
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetModeConfigResult) IsSetSuccess() bool {
|
||||
return p.Success != nil
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetModeConfigResult) Read(iprot thrift.TProtocol) (err error) {
|
||||
var fieldTypeId thrift.TType
|
||||
var fieldId int16
|
||||
|
||||
if _, err = iprot.ReadStructBegin(); err != nil {
|
||||
goto ReadStructBeginError
|
||||
}
|
||||
|
||||
for {
|
||||
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
||||
if err != nil {
|
||||
goto ReadFieldBeginError
|
||||
}
|
||||
if fieldTypeId == thrift.STOP {
|
||||
break
|
||||
}
|
||||
|
||||
switch fieldId {
|
||||
case 0:
|
||||
if fieldTypeId == thrift.STRUCT {
|
||||
if err = p.ReadField0(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
default:
|
||||
if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadFieldEnd(); err != nil {
|
||||
goto ReadFieldEndError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadStructEnd(); err != nil {
|
||||
goto ReadStructEndError
|
||||
}
|
||||
|
||||
return nil
|
||||
ReadStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
||||
ReadFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
||||
ReadFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_DatasetServiceGetModeConfigResult[fieldId]), err)
|
||||
SkipFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
||||
|
||||
ReadFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
||||
ReadStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetModeConfigResult) ReadField0(iprot thrift.TProtocol) error {
|
||||
_field := NewGetModeConfigResponse()
|
||||
if err := _field.Read(iprot); err != nil {
|
||||
return err
|
||||
}
|
||||
p.Success = _field
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetModeConfigResult) Write(oprot thrift.TProtocol) (err error) {
|
||||
var fieldId int16
|
||||
if err = oprot.WriteStructBegin("GetModeConfig_result"); err != nil {
|
||||
goto WriteStructBeginError
|
||||
}
|
||||
if p != nil {
|
||||
if err = p.writeField0(oprot); err != nil {
|
||||
fieldId = 0
|
||||
goto WriteFieldError
|
||||
}
|
||||
}
|
||||
if err = oprot.WriteFieldStop(); err != nil {
|
||||
goto WriteFieldStopError
|
||||
}
|
||||
if err = oprot.WriteStructEnd(); err != nil {
|
||||
goto WriteStructEndError
|
||||
}
|
||||
return nil
|
||||
WriteStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
||||
WriteFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
||||
WriteFieldStopError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
||||
WriteStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetModeConfigResult) writeField0(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetSuccess() {
|
||||
if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := p.Success.Write(oprot); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetModeConfigResult) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("DatasetServiceGetModeConfigResult(%+v)", *p)
|
||||
|
||||
}
|
||||
|
||||
type DatasetServiceCreateDocumentArgs struct {
|
||||
Req *CreateDocumentRequest `thrift:"req,1"`
|
||||
}
|
||||
@ -6834,6 +7246,298 @@ func (p *DatasetServiceValidateTableSchemaResult) String() string {
|
||||
|
||||
}
|
||||
|
||||
type DatasetServiceGetDocumentTableInfoArgs struct {
|
||||
Req *GetDocumentTableInfoRequest `thrift:"req,1"`
|
||||
}
|
||||
|
||||
func NewDatasetServiceGetDocumentTableInfoArgs() *DatasetServiceGetDocumentTableInfoArgs {
|
||||
return &DatasetServiceGetDocumentTableInfoArgs{}
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetDocumentTableInfoArgs) InitDefault() {
|
||||
}
|
||||
|
||||
var DatasetServiceGetDocumentTableInfoArgs_Req_DEFAULT *GetDocumentTableInfoRequest
|
||||
|
||||
func (p *DatasetServiceGetDocumentTableInfoArgs) GetReq() (v *GetDocumentTableInfoRequest) {
|
||||
if !p.IsSetReq() {
|
||||
return DatasetServiceGetDocumentTableInfoArgs_Req_DEFAULT
|
||||
}
|
||||
return p.Req
|
||||
}
|
||||
|
||||
var fieldIDToName_DatasetServiceGetDocumentTableInfoArgs = map[int16]string{
|
||||
1: "req",
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetDocumentTableInfoArgs) IsSetReq() bool {
|
||||
return p.Req != nil
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetDocumentTableInfoArgs) Read(iprot thrift.TProtocol) (err error) {
|
||||
var fieldTypeId thrift.TType
|
||||
var fieldId int16
|
||||
|
||||
if _, err = iprot.ReadStructBegin(); err != nil {
|
||||
goto ReadStructBeginError
|
||||
}
|
||||
|
||||
for {
|
||||
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
||||
if err != nil {
|
||||
goto ReadFieldBeginError
|
||||
}
|
||||
if fieldTypeId == thrift.STOP {
|
||||
break
|
||||
}
|
||||
|
||||
switch fieldId {
|
||||
case 1:
|
||||
if fieldTypeId == thrift.STRUCT {
|
||||
if err = p.ReadField1(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
default:
|
||||
if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadFieldEnd(); err != nil {
|
||||
goto ReadFieldEndError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadStructEnd(); err != nil {
|
||||
goto ReadStructEndError
|
||||
}
|
||||
|
||||
return nil
|
||||
ReadStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
||||
ReadFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
||||
ReadFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_DatasetServiceGetDocumentTableInfoArgs[fieldId]), err)
|
||||
SkipFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
||||
|
||||
ReadFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
||||
ReadStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetDocumentTableInfoArgs) ReadField1(iprot thrift.TProtocol) error {
|
||||
_field := NewGetDocumentTableInfoRequest()
|
||||
if err := _field.Read(iprot); err != nil {
|
||||
return err
|
||||
}
|
||||
p.Req = _field
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetDocumentTableInfoArgs) Write(oprot thrift.TProtocol) (err error) {
|
||||
var fieldId int16
|
||||
if err = oprot.WriteStructBegin("GetDocumentTableInfo_args"); err != nil {
|
||||
goto WriteStructBeginError
|
||||
}
|
||||
if p != nil {
|
||||
if err = p.writeField1(oprot); err != nil {
|
||||
fieldId = 1
|
||||
goto WriteFieldError
|
||||
}
|
||||
}
|
||||
if err = oprot.WriteFieldStop(); err != nil {
|
||||
goto WriteFieldStopError
|
||||
}
|
||||
if err = oprot.WriteStructEnd(); err != nil {
|
||||
goto WriteStructEndError
|
||||
}
|
||||
return nil
|
||||
WriteStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
||||
WriteFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
||||
WriteFieldStopError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
||||
WriteStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetDocumentTableInfoArgs) writeField1(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := p.Req.Write(oprot); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetDocumentTableInfoArgs) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("DatasetServiceGetDocumentTableInfoArgs(%+v)", *p)
|
||||
|
||||
}
|
||||
|
||||
type DatasetServiceGetDocumentTableInfoResult struct {
|
||||
Success *GetDocumentTableInfoResponse `thrift:"success,0,optional"`
|
||||
}
|
||||
|
||||
func NewDatasetServiceGetDocumentTableInfoResult() *DatasetServiceGetDocumentTableInfoResult {
|
||||
return &DatasetServiceGetDocumentTableInfoResult{}
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetDocumentTableInfoResult) InitDefault() {
|
||||
}
|
||||
|
||||
var DatasetServiceGetDocumentTableInfoResult_Success_DEFAULT *GetDocumentTableInfoResponse
|
||||
|
||||
func (p *DatasetServiceGetDocumentTableInfoResult) GetSuccess() (v *GetDocumentTableInfoResponse) {
|
||||
if !p.IsSetSuccess() {
|
||||
return DatasetServiceGetDocumentTableInfoResult_Success_DEFAULT
|
||||
}
|
||||
return p.Success
|
||||
}
|
||||
|
||||
var fieldIDToName_DatasetServiceGetDocumentTableInfoResult = map[int16]string{
|
||||
0: "success",
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetDocumentTableInfoResult) IsSetSuccess() bool {
|
||||
return p.Success != nil
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetDocumentTableInfoResult) Read(iprot thrift.TProtocol) (err error) {
|
||||
var fieldTypeId thrift.TType
|
||||
var fieldId int16
|
||||
|
||||
if _, err = iprot.ReadStructBegin(); err != nil {
|
||||
goto ReadStructBeginError
|
||||
}
|
||||
|
||||
for {
|
||||
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
||||
if err != nil {
|
||||
goto ReadFieldBeginError
|
||||
}
|
||||
if fieldTypeId == thrift.STOP {
|
||||
break
|
||||
}
|
||||
|
||||
switch fieldId {
|
||||
case 0:
|
||||
if fieldTypeId == thrift.STRUCT {
|
||||
if err = p.ReadField0(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
default:
|
||||
if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadFieldEnd(); err != nil {
|
||||
goto ReadFieldEndError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadStructEnd(); err != nil {
|
||||
goto ReadStructEndError
|
||||
}
|
||||
|
||||
return nil
|
||||
ReadStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
||||
ReadFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
||||
ReadFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_DatasetServiceGetDocumentTableInfoResult[fieldId]), err)
|
||||
SkipFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
||||
|
||||
ReadFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
||||
ReadStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetDocumentTableInfoResult) ReadField0(iprot thrift.TProtocol) error {
|
||||
_field := NewGetDocumentTableInfoResponse()
|
||||
if err := _field.Read(iprot); err != nil {
|
||||
return err
|
||||
}
|
||||
p.Success = _field
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetDocumentTableInfoResult) Write(oprot thrift.TProtocol) (err error) {
|
||||
var fieldId int16
|
||||
if err = oprot.WriteStructBegin("GetDocumentTableInfo_result"); err != nil {
|
||||
goto WriteStructBeginError
|
||||
}
|
||||
if p != nil {
|
||||
if err = p.writeField0(oprot); err != nil {
|
||||
fieldId = 0
|
||||
goto WriteFieldError
|
||||
}
|
||||
}
|
||||
if err = oprot.WriteFieldStop(); err != nil {
|
||||
goto WriteFieldStopError
|
||||
}
|
||||
if err = oprot.WriteStructEnd(); err != nil {
|
||||
goto WriteStructEndError
|
||||
}
|
||||
return nil
|
||||
WriteStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
||||
WriteFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
||||
WriteFieldStopError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
||||
WriteStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetDocumentTableInfoResult) writeField0(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetSuccess() {
|
||||
if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := p.Success.Write(oprot); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *DatasetServiceGetDocumentTableInfoResult) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("DatasetServiceGetDocumentTableInfoResult(%+v)", *p)
|
||||
|
||||
}
|
||||
|
||||
type DatasetServiceDeleteSliceArgs struct {
|
||||
Req *DeleteSliceRequest `thrift:"req,1"`
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
// Code generated by thriftgo (0.4.1). DO NOT EDIT.
|
||||
|
||||
package dataset
|
||||
package knowledge
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@ -1,6 +1,6 @@
|
||||
// Code generated by thriftgo (0.4.1). DO NOT EDIT.
|
||||
|
||||
package dataset
|
||||
package knowledge
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
@ -6,8 +6,8 @@ import (
|
||||
"fmt"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/base"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/project_memory"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/table"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/data/database/table"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/data/variable/project_memory"
|
||||
)
|
||||
|
||||
type KVItem struct {
|
||||
@ -1,15 +1,13 @@
|
||||
// Code generated by thriftgo (0.4.1). DO NOT EDIT.
|
||||
|
||||
package memory
|
||||
package variable
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/knowledge/document"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/kvmemory"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/project_memory"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/table"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/data/variable/kvmemory"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/data/variable/project_memory"
|
||||
)
|
||||
|
||||
type MemoryService interface {
|
||||
@ -27,10 +25,6 @@ type MemoryService interface {
|
||||
GetSysVariableConf(ctx context.Context, req *kvmemory.GetSysVariableConfRequest) (r *kvmemory.GetSysVariableConfResponse, err error)
|
||||
|
||||
SetKvMemory(ctx context.Context, req *kvmemory.SetKvMemoryReq) (r *kvmemory.SetKvMemoryResp, err error)
|
||||
// ---
|
||||
GetModeConfig(ctx context.Context, req *table.GetModeConfigRequest) (r *table.GetModeConfigResponse, err error)
|
||||
|
||||
GetDocumentTableInfo(ctx context.Context, req *document.GetDocumentTableInfoRequest) (r *document.GetDocumentTableInfoResponse, err error)
|
||||
}
|
||||
|
||||
type MemoryServiceClient struct {
|
||||
@ -122,24 +116,6 @@ func (p *MemoryServiceClient) SetKvMemory(ctx context.Context, req *kvmemory.Set
|
||||
}
|
||||
return _result.GetSuccess(), nil
|
||||
}
|
||||
func (p *MemoryServiceClient) GetModeConfig(ctx context.Context, req *table.GetModeConfigRequest) (r *table.GetModeConfigResponse, err error) {
|
||||
var _args MemoryServiceGetModeConfigArgs
|
||||
_args.Req = req
|
||||
var _result MemoryServiceGetModeConfigResult
|
||||
if err = p.Client_().Call(ctx, "GetModeConfig", &_args, &_result); err != nil {
|
||||
return
|
||||
}
|
||||
return _result.GetSuccess(), nil
|
||||
}
|
||||
func (p *MemoryServiceClient) GetDocumentTableInfo(ctx context.Context, req *document.GetDocumentTableInfoRequest) (r *document.GetDocumentTableInfoResponse, err error) {
|
||||
var _args MemoryServiceGetDocumentTableInfoArgs
|
||||
_args.Req = req
|
||||
var _result MemoryServiceGetDocumentTableInfoResult
|
||||
if err = p.Client_().Call(ctx, "GetDocumentTableInfo", &_args, &_result); err != nil {
|
||||
return
|
||||
}
|
||||
return _result.GetSuccess(), nil
|
||||
}
|
||||
|
||||
type MemoryServiceProcessor struct {
|
||||
processorMap map[string]thrift.TProcessorFunction
|
||||
@ -168,8 +144,6 @@ func NewMemoryServiceProcessor(handler MemoryService) *MemoryServiceProcessor {
|
||||
self.AddToProcessorMap("GetPlayGroundMemory", &memoryServiceProcessorGetPlayGroundMemory{handler: handler})
|
||||
self.AddToProcessorMap("GetSysVariableConf", &memoryServiceProcessorGetSysVariableConf{handler: handler})
|
||||
self.AddToProcessorMap("SetKvMemory", &memoryServiceProcessorSetKvMemory{handler: handler})
|
||||
self.AddToProcessorMap("GetModeConfig", &memoryServiceProcessorGetModeConfig{handler: handler})
|
||||
self.AddToProcessorMap("GetDocumentTableInfo", &memoryServiceProcessorGetDocumentTableInfo{handler: handler})
|
||||
return self
|
||||
}
|
||||
func (p *MemoryServiceProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
|
||||
@ -526,102 +500,6 @@ func (p *memoryServiceProcessorSetKvMemory) Process(ctx context.Context, seqId i
|
||||
return true, err
|
||||
}
|
||||
|
||||
type memoryServiceProcessorGetModeConfig struct {
|
||||
handler MemoryService
|
||||
}
|
||||
|
||||
func (p *memoryServiceProcessorGetModeConfig) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
|
||||
args := MemoryServiceGetModeConfigArgs{}
|
||||
if err = args.Read(iprot); err != nil {
|
||||
iprot.ReadMessageEnd()
|
||||
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
|
||||
oprot.WriteMessageBegin("GetModeConfig", thrift.EXCEPTION, seqId)
|
||||
x.Write(oprot)
|
||||
oprot.WriteMessageEnd()
|
||||
oprot.Flush(ctx)
|
||||
return false, err
|
||||
}
|
||||
|
||||
iprot.ReadMessageEnd()
|
||||
var err2 error
|
||||
result := MemoryServiceGetModeConfigResult{}
|
||||
var retval *table.GetModeConfigResponse
|
||||
if retval, err2 = p.handler.GetModeConfig(ctx, args.Req); err2 != nil {
|
||||
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetModeConfig: "+err2.Error())
|
||||
oprot.WriteMessageBegin("GetModeConfig", thrift.EXCEPTION, seqId)
|
||||
x.Write(oprot)
|
||||
oprot.WriteMessageEnd()
|
||||
oprot.Flush(ctx)
|
||||
return true, err2
|
||||
} else {
|
||||
result.Success = retval
|
||||
}
|
||||
if err2 = oprot.WriteMessageBegin("GetModeConfig", thrift.REPLY, seqId); err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err2 = result.Write(oprot); err == nil && err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return true, err
|
||||
}
|
||||
|
||||
type memoryServiceProcessorGetDocumentTableInfo struct {
|
||||
handler MemoryService
|
||||
}
|
||||
|
||||
func (p *memoryServiceProcessorGetDocumentTableInfo) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
|
||||
args := MemoryServiceGetDocumentTableInfoArgs{}
|
||||
if err = args.Read(iprot); err != nil {
|
||||
iprot.ReadMessageEnd()
|
||||
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
|
||||
oprot.WriteMessageBegin("GetDocumentTableInfo", thrift.EXCEPTION, seqId)
|
||||
x.Write(oprot)
|
||||
oprot.WriteMessageEnd()
|
||||
oprot.Flush(ctx)
|
||||
return false, err
|
||||
}
|
||||
|
||||
iprot.ReadMessageEnd()
|
||||
var err2 error
|
||||
result := MemoryServiceGetDocumentTableInfoResult{}
|
||||
var retval *document.GetDocumentTableInfoResponse
|
||||
if retval, err2 = p.handler.GetDocumentTableInfo(ctx, args.Req); err2 != nil {
|
||||
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing GetDocumentTableInfo: "+err2.Error())
|
||||
oprot.WriteMessageBegin("GetDocumentTableInfo", thrift.EXCEPTION, seqId)
|
||||
x.Write(oprot)
|
||||
oprot.WriteMessageEnd()
|
||||
oprot.Flush(ctx)
|
||||
return true, err2
|
||||
} else {
|
||||
result.Success = retval
|
||||
}
|
||||
if err2 = oprot.WriteMessageBegin("GetDocumentTableInfo", thrift.REPLY, seqId); err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err2 = result.Write(oprot); err == nil && err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return true, err
|
||||
}
|
||||
|
||||
type MemoryServiceGetProjectVariableListArgs struct {
|
||||
Req *project_memory.GetProjectVariableListReq `thrift:"req,1"`
|
||||
}
|
||||
@ -2665,587 +2543,3 @@ func (p *MemoryServiceSetKvMemoryResult) String() string {
|
||||
return fmt.Sprintf("MemoryServiceSetKvMemoryResult(%+v)", *p)
|
||||
|
||||
}
|
||||
|
||||
type MemoryServiceGetModeConfigArgs struct {
|
||||
Req *table.GetModeConfigRequest `thrift:"req,1"`
|
||||
}
|
||||
|
||||
func NewMemoryServiceGetModeConfigArgs() *MemoryServiceGetModeConfigArgs {
|
||||
return &MemoryServiceGetModeConfigArgs{}
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetModeConfigArgs) InitDefault() {
|
||||
}
|
||||
|
||||
var MemoryServiceGetModeConfigArgs_Req_DEFAULT *table.GetModeConfigRequest
|
||||
|
||||
func (p *MemoryServiceGetModeConfigArgs) GetReq() (v *table.GetModeConfigRequest) {
|
||||
if !p.IsSetReq() {
|
||||
return MemoryServiceGetModeConfigArgs_Req_DEFAULT
|
||||
}
|
||||
return p.Req
|
||||
}
|
||||
|
||||
var fieldIDToName_MemoryServiceGetModeConfigArgs = map[int16]string{
|
||||
1: "req",
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetModeConfigArgs) IsSetReq() bool {
|
||||
return p.Req != nil
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetModeConfigArgs) Read(iprot thrift.TProtocol) (err error) {
|
||||
var fieldTypeId thrift.TType
|
||||
var fieldId int16
|
||||
|
||||
if _, err = iprot.ReadStructBegin(); err != nil {
|
||||
goto ReadStructBeginError
|
||||
}
|
||||
|
||||
for {
|
||||
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
||||
if err != nil {
|
||||
goto ReadFieldBeginError
|
||||
}
|
||||
if fieldTypeId == thrift.STOP {
|
||||
break
|
||||
}
|
||||
|
||||
switch fieldId {
|
||||
case 1:
|
||||
if fieldTypeId == thrift.STRUCT {
|
||||
if err = p.ReadField1(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
default:
|
||||
if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadFieldEnd(); err != nil {
|
||||
goto ReadFieldEndError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadStructEnd(); err != nil {
|
||||
goto ReadStructEndError
|
||||
}
|
||||
|
||||
return nil
|
||||
ReadStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
||||
ReadFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
||||
ReadFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_MemoryServiceGetModeConfigArgs[fieldId]), err)
|
||||
SkipFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
||||
|
||||
ReadFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
||||
ReadStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetModeConfigArgs) ReadField1(iprot thrift.TProtocol) error {
|
||||
_field := table.NewGetModeConfigRequest()
|
||||
if err := _field.Read(iprot); err != nil {
|
||||
return err
|
||||
}
|
||||
p.Req = _field
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetModeConfigArgs) Write(oprot thrift.TProtocol) (err error) {
|
||||
var fieldId int16
|
||||
if err = oprot.WriteStructBegin("GetModeConfig_args"); err != nil {
|
||||
goto WriteStructBeginError
|
||||
}
|
||||
if p != nil {
|
||||
if err = p.writeField1(oprot); err != nil {
|
||||
fieldId = 1
|
||||
goto WriteFieldError
|
||||
}
|
||||
}
|
||||
if err = oprot.WriteFieldStop(); err != nil {
|
||||
goto WriteFieldStopError
|
||||
}
|
||||
if err = oprot.WriteStructEnd(); err != nil {
|
||||
goto WriteStructEndError
|
||||
}
|
||||
return nil
|
||||
WriteStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
||||
WriteFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
||||
WriteFieldStopError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
||||
WriteStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetModeConfigArgs) writeField1(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := p.Req.Write(oprot); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetModeConfigArgs) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("MemoryServiceGetModeConfigArgs(%+v)", *p)
|
||||
|
||||
}
|
||||
|
||||
type MemoryServiceGetModeConfigResult struct {
|
||||
Success *table.GetModeConfigResponse `thrift:"success,0,optional"`
|
||||
}
|
||||
|
||||
func NewMemoryServiceGetModeConfigResult() *MemoryServiceGetModeConfigResult {
|
||||
return &MemoryServiceGetModeConfigResult{}
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetModeConfigResult) InitDefault() {
|
||||
}
|
||||
|
||||
var MemoryServiceGetModeConfigResult_Success_DEFAULT *table.GetModeConfigResponse
|
||||
|
||||
func (p *MemoryServiceGetModeConfigResult) GetSuccess() (v *table.GetModeConfigResponse) {
|
||||
if !p.IsSetSuccess() {
|
||||
return MemoryServiceGetModeConfigResult_Success_DEFAULT
|
||||
}
|
||||
return p.Success
|
||||
}
|
||||
|
||||
var fieldIDToName_MemoryServiceGetModeConfigResult = map[int16]string{
|
||||
0: "success",
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetModeConfigResult) IsSetSuccess() bool {
|
||||
return p.Success != nil
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetModeConfigResult) Read(iprot thrift.TProtocol) (err error) {
|
||||
var fieldTypeId thrift.TType
|
||||
var fieldId int16
|
||||
|
||||
if _, err = iprot.ReadStructBegin(); err != nil {
|
||||
goto ReadStructBeginError
|
||||
}
|
||||
|
||||
for {
|
||||
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
||||
if err != nil {
|
||||
goto ReadFieldBeginError
|
||||
}
|
||||
if fieldTypeId == thrift.STOP {
|
||||
break
|
||||
}
|
||||
|
||||
switch fieldId {
|
||||
case 0:
|
||||
if fieldTypeId == thrift.STRUCT {
|
||||
if err = p.ReadField0(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
default:
|
||||
if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadFieldEnd(); err != nil {
|
||||
goto ReadFieldEndError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadStructEnd(); err != nil {
|
||||
goto ReadStructEndError
|
||||
}
|
||||
|
||||
return nil
|
||||
ReadStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
||||
ReadFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
||||
ReadFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_MemoryServiceGetModeConfigResult[fieldId]), err)
|
||||
SkipFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
||||
|
||||
ReadFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
||||
ReadStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetModeConfigResult) ReadField0(iprot thrift.TProtocol) error {
|
||||
_field := table.NewGetModeConfigResponse()
|
||||
if err := _field.Read(iprot); err != nil {
|
||||
return err
|
||||
}
|
||||
p.Success = _field
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetModeConfigResult) Write(oprot thrift.TProtocol) (err error) {
|
||||
var fieldId int16
|
||||
if err = oprot.WriteStructBegin("GetModeConfig_result"); err != nil {
|
||||
goto WriteStructBeginError
|
||||
}
|
||||
if p != nil {
|
||||
if err = p.writeField0(oprot); err != nil {
|
||||
fieldId = 0
|
||||
goto WriteFieldError
|
||||
}
|
||||
}
|
||||
if err = oprot.WriteFieldStop(); err != nil {
|
||||
goto WriteFieldStopError
|
||||
}
|
||||
if err = oprot.WriteStructEnd(); err != nil {
|
||||
goto WriteStructEndError
|
||||
}
|
||||
return nil
|
||||
WriteStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
||||
WriteFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
||||
WriteFieldStopError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
||||
WriteStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetModeConfigResult) writeField0(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetSuccess() {
|
||||
if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := p.Success.Write(oprot); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetModeConfigResult) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("MemoryServiceGetModeConfigResult(%+v)", *p)
|
||||
|
||||
}
|
||||
|
||||
type MemoryServiceGetDocumentTableInfoArgs struct {
|
||||
Req *document.GetDocumentTableInfoRequest `thrift:"req,1"`
|
||||
}
|
||||
|
||||
func NewMemoryServiceGetDocumentTableInfoArgs() *MemoryServiceGetDocumentTableInfoArgs {
|
||||
return &MemoryServiceGetDocumentTableInfoArgs{}
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetDocumentTableInfoArgs) InitDefault() {
|
||||
}
|
||||
|
||||
var MemoryServiceGetDocumentTableInfoArgs_Req_DEFAULT *document.GetDocumentTableInfoRequest
|
||||
|
||||
func (p *MemoryServiceGetDocumentTableInfoArgs) GetReq() (v *document.GetDocumentTableInfoRequest) {
|
||||
if !p.IsSetReq() {
|
||||
return MemoryServiceGetDocumentTableInfoArgs_Req_DEFAULT
|
||||
}
|
||||
return p.Req
|
||||
}
|
||||
|
||||
var fieldIDToName_MemoryServiceGetDocumentTableInfoArgs = map[int16]string{
|
||||
1: "req",
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetDocumentTableInfoArgs) IsSetReq() bool {
|
||||
return p.Req != nil
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetDocumentTableInfoArgs) Read(iprot thrift.TProtocol) (err error) {
|
||||
var fieldTypeId thrift.TType
|
||||
var fieldId int16
|
||||
|
||||
if _, err = iprot.ReadStructBegin(); err != nil {
|
||||
goto ReadStructBeginError
|
||||
}
|
||||
|
||||
for {
|
||||
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
||||
if err != nil {
|
||||
goto ReadFieldBeginError
|
||||
}
|
||||
if fieldTypeId == thrift.STOP {
|
||||
break
|
||||
}
|
||||
|
||||
switch fieldId {
|
||||
case 1:
|
||||
if fieldTypeId == thrift.STRUCT {
|
||||
if err = p.ReadField1(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
default:
|
||||
if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadFieldEnd(); err != nil {
|
||||
goto ReadFieldEndError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadStructEnd(); err != nil {
|
||||
goto ReadStructEndError
|
||||
}
|
||||
|
||||
return nil
|
||||
ReadStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
||||
ReadFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
||||
ReadFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_MemoryServiceGetDocumentTableInfoArgs[fieldId]), err)
|
||||
SkipFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
||||
|
||||
ReadFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
||||
ReadStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetDocumentTableInfoArgs) ReadField1(iprot thrift.TProtocol) error {
|
||||
_field := document.NewGetDocumentTableInfoRequest()
|
||||
if err := _field.Read(iprot); err != nil {
|
||||
return err
|
||||
}
|
||||
p.Req = _field
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetDocumentTableInfoArgs) Write(oprot thrift.TProtocol) (err error) {
|
||||
var fieldId int16
|
||||
if err = oprot.WriteStructBegin("GetDocumentTableInfo_args"); err != nil {
|
||||
goto WriteStructBeginError
|
||||
}
|
||||
if p != nil {
|
||||
if err = p.writeField1(oprot); err != nil {
|
||||
fieldId = 1
|
||||
goto WriteFieldError
|
||||
}
|
||||
}
|
||||
if err = oprot.WriteFieldStop(); err != nil {
|
||||
goto WriteFieldStopError
|
||||
}
|
||||
if err = oprot.WriteStructEnd(); err != nil {
|
||||
goto WriteStructEndError
|
||||
}
|
||||
return nil
|
||||
WriteStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
||||
WriteFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
||||
WriteFieldStopError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
||||
WriteStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetDocumentTableInfoArgs) writeField1(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("req", thrift.STRUCT, 1); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := p.Req.Write(oprot); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetDocumentTableInfoArgs) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("MemoryServiceGetDocumentTableInfoArgs(%+v)", *p)
|
||||
|
||||
}
|
||||
|
||||
type MemoryServiceGetDocumentTableInfoResult struct {
|
||||
Success *document.GetDocumentTableInfoResponse `thrift:"success,0,optional"`
|
||||
}
|
||||
|
||||
func NewMemoryServiceGetDocumentTableInfoResult() *MemoryServiceGetDocumentTableInfoResult {
|
||||
return &MemoryServiceGetDocumentTableInfoResult{}
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetDocumentTableInfoResult) InitDefault() {
|
||||
}
|
||||
|
||||
var MemoryServiceGetDocumentTableInfoResult_Success_DEFAULT *document.GetDocumentTableInfoResponse
|
||||
|
||||
func (p *MemoryServiceGetDocumentTableInfoResult) GetSuccess() (v *document.GetDocumentTableInfoResponse) {
|
||||
if !p.IsSetSuccess() {
|
||||
return MemoryServiceGetDocumentTableInfoResult_Success_DEFAULT
|
||||
}
|
||||
return p.Success
|
||||
}
|
||||
|
||||
var fieldIDToName_MemoryServiceGetDocumentTableInfoResult = map[int16]string{
|
||||
0: "success",
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetDocumentTableInfoResult) IsSetSuccess() bool {
|
||||
return p.Success != nil
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetDocumentTableInfoResult) Read(iprot thrift.TProtocol) (err error) {
|
||||
var fieldTypeId thrift.TType
|
||||
var fieldId int16
|
||||
|
||||
if _, err = iprot.ReadStructBegin(); err != nil {
|
||||
goto ReadStructBeginError
|
||||
}
|
||||
|
||||
for {
|
||||
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
||||
if err != nil {
|
||||
goto ReadFieldBeginError
|
||||
}
|
||||
if fieldTypeId == thrift.STOP {
|
||||
break
|
||||
}
|
||||
|
||||
switch fieldId {
|
||||
case 0:
|
||||
if fieldTypeId == thrift.STRUCT {
|
||||
if err = p.ReadField0(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
default:
|
||||
if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadFieldEnd(); err != nil {
|
||||
goto ReadFieldEndError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadStructEnd(); err != nil {
|
||||
goto ReadStructEndError
|
||||
}
|
||||
|
||||
return nil
|
||||
ReadStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
||||
ReadFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
||||
ReadFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_MemoryServiceGetDocumentTableInfoResult[fieldId]), err)
|
||||
SkipFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
||||
|
||||
ReadFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
||||
ReadStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetDocumentTableInfoResult) ReadField0(iprot thrift.TProtocol) error {
|
||||
_field := document.NewGetDocumentTableInfoResponse()
|
||||
if err := _field.Read(iprot); err != nil {
|
||||
return err
|
||||
}
|
||||
p.Success = _field
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetDocumentTableInfoResult) Write(oprot thrift.TProtocol) (err error) {
|
||||
var fieldId int16
|
||||
if err = oprot.WriteStructBegin("GetDocumentTableInfo_result"); err != nil {
|
||||
goto WriteStructBeginError
|
||||
}
|
||||
if p != nil {
|
||||
if err = p.writeField0(oprot); err != nil {
|
||||
fieldId = 0
|
||||
goto WriteFieldError
|
||||
}
|
||||
}
|
||||
if err = oprot.WriteFieldStop(); err != nil {
|
||||
goto WriteFieldStopError
|
||||
}
|
||||
if err = oprot.WriteStructEnd(); err != nil {
|
||||
goto WriteStructEndError
|
||||
}
|
||||
return nil
|
||||
WriteStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
||||
WriteFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
||||
WriteFieldStopError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
||||
WriteStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetDocumentTableInfoResult) writeField0(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetSuccess() {
|
||||
if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := p.Success.Write(oprot); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *MemoryServiceGetDocumentTableInfoResult) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("MemoryServiceGetDocumentTableInfoResult(%+v)", *p)
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,810 +0,0 @@
|
||||
// Code generated by thriftgo (0.4.1). DO NOT EDIT.
|
||||
|
||||
package testcase
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/flow/devops/debugger/domain/infra"
|
||||
)
|
||||
|
||||
type CaseDataBase struct {
|
||||
// Do not fill in when adding, fill in when updating
|
||||
CaseID *int64 `thrift:"caseID,1,optional" json:"caseID,string" form:"caseID" query:"caseID"`
|
||||
Name *string `thrift:"name,2,optional" form:"name" json:"name,omitempty" query:"name"`
|
||||
Description *string `thrift:"description,3,optional" form:"description" json:"description,omitempty" query:"description"`
|
||||
// Input information in JSON format
|
||||
Input *string `thrift:"input,4,optional" form:"input" json:"input,omitempty" query:"input"`
|
||||
IsDefault *bool `thrift:"isDefault,5,optional" form:"isDefault" json:"isDefault,omitempty" query:"isDefault"`
|
||||
}
|
||||
|
||||
func NewCaseDataBase() *CaseDataBase {
|
||||
return &CaseDataBase{}
|
||||
}
|
||||
|
||||
func (p *CaseDataBase) InitDefault() {
|
||||
}
|
||||
|
||||
var CaseDataBase_CaseID_DEFAULT int64
|
||||
|
||||
func (p *CaseDataBase) GetCaseID() (v int64) {
|
||||
if !p.IsSetCaseID() {
|
||||
return CaseDataBase_CaseID_DEFAULT
|
||||
}
|
||||
return *p.CaseID
|
||||
}
|
||||
|
||||
var CaseDataBase_Name_DEFAULT string
|
||||
|
||||
func (p *CaseDataBase) GetName() (v string) {
|
||||
if !p.IsSetName() {
|
||||
return CaseDataBase_Name_DEFAULT
|
||||
}
|
||||
return *p.Name
|
||||
}
|
||||
|
||||
var CaseDataBase_Description_DEFAULT string
|
||||
|
||||
func (p *CaseDataBase) GetDescription() (v string) {
|
||||
if !p.IsSetDescription() {
|
||||
return CaseDataBase_Description_DEFAULT
|
||||
}
|
||||
return *p.Description
|
||||
}
|
||||
|
||||
var CaseDataBase_Input_DEFAULT string
|
||||
|
||||
func (p *CaseDataBase) GetInput() (v string) {
|
||||
if !p.IsSetInput() {
|
||||
return CaseDataBase_Input_DEFAULT
|
||||
}
|
||||
return *p.Input
|
||||
}
|
||||
|
||||
var CaseDataBase_IsDefault_DEFAULT bool
|
||||
|
||||
func (p *CaseDataBase) GetIsDefault() (v bool) {
|
||||
if !p.IsSetIsDefault() {
|
||||
return CaseDataBase_IsDefault_DEFAULT
|
||||
}
|
||||
return *p.IsDefault
|
||||
}
|
||||
|
||||
var fieldIDToName_CaseDataBase = map[int16]string{
|
||||
1: "caseID",
|
||||
2: "name",
|
||||
3: "description",
|
||||
4: "input",
|
||||
5: "isDefault",
|
||||
}
|
||||
|
||||
func (p *CaseDataBase) IsSetCaseID() bool {
|
||||
return p.CaseID != nil
|
||||
}
|
||||
|
||||
func (p *CaseDataBase) IsSetName() bool {
|
||||
return p.Name != nil
|
||||
}
|
||||
|
||||
func (p *CaseDataBase) IsSetDescription() bool {
|
||||
return p.Description != nil
|
||||
}
|
||||
|
||||
func (p *CaseDataBase) IsSetInput() bool {
|
||||
return p.Input != nil
|
||||
}
|
||||
|
||||
func (p *CaseDataBase) IsSetIsDefault() bool {
|
||||
return p.IsDefault != nil
|
||||
}
|
||||
|
||||
func (p *CaseDataBase) Read(iprot thrift.TProtocol) (err error) {
|
||||
var fieldTypeId thrift.TType
|
||||
var fieldId int16
|
||||
|
||||
if _, err = iprot.ReadStructBegin(); err != nil {
|
||||
goto ReadStructBeginError
|
||||
}
|
||||
|
||||
for {
|
||||
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
||||
if err != nil {
|
||||
goto ReadFieldBeginError
|
||||
}
|
||||
if fieldTypeId == thrift.STOP {
|
||||
break
|
||||
}
|
||||
|
||||
switch fieldId {
|
||||
case 1:
|
||||
if fieldTypeId == thrift.I64 {
|
||||
if err = p.ReadField1(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 2:
|
||||
if fieldTypeId == thrift.STRING {
|
||||
if err = p.ReadField2(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 3:
|
||||
if fieldTypeId == thrift.STRING {
|
||||
if err = p.ReadField3(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 4:
|
||||
if fieldTypeId == thrift.STRING {
|
||||
if err = p.ReadField4(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 5:
|
||||
if fieldTypeId == thrift.BOOL {
|
||||
if err = p.ReadField5(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
default:
|
||||
if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadFieldEnd(); err != nil {
|
||||
goto ReadFieldEndError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadStructEnd(); err != nil {
|
||||
goto ReadStructEndError
|
||||
}
|
||||
|
||||
return nil
|
||||
ReadStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
||||
ReadFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
||||
ReadFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CaseDataBase[fieldId]), err)
|
||||
SkipFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
||||
|
||||
ReadFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
||||
ReadStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *CaseDataBase) ReadField1(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field *int64
|
||||
if v, err := iprot.ReadI64(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = &v
|
||||
}
|
||||
p.CaseID = _field
|
||||
return nil
|
||||
}
|
||||
func (p *CaseDataBase) ReadField2(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field *string
|
||||
if v, err := iprot.ReadString(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = &v
|
||||
}
|
||||
p.Name = _field
|
||||
return nil
|
||||
}
|
||||
func (p *CaseDataBase) ReadField3(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field *string
|
||||
if v, err := iprot.ReadString(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = &v
|
||||
}
|
||||
p.Description = _field
|
||||
return nil
|
||||
}
|
||||
func (p *CaseDataBase) ReadField4(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field *string
|
||||
if v, err := iprot.ReadString(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = &v
|
||||
}
|
||||
p.Input = _field
|
||||
return nil
|
||||
}
|
||||
func (p *CaseDataBase) ReadField5(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field *bool
|
||||
if v, err := iprot.ReadBool(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = &v
|
||||
}
|
||||
p.IsDefault = _field
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *CaseDataBase) Write(oprot thrift.TProtocol) (err error) {
|
||||
var fieldId int16
|
||||
if err = oprot.WriteStructBegin("CaseDataBase"); err != nil {
|
||||
goto WriteStructBeginError
|
||||
}
|
||||
if p != nil {
|
||||
if err = p.writeField1(oprot); err != nil {
|
||||
fieldId = 1
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField2(oprot); err != nil {
|
||||
fieldId = 2
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField3(oprot); err != nil {
|
||||
fieldId = 3
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField4(oprot); err != nil {
|
||||
fieldId = 4
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField5(oprot); err != nil {
|
||||
fieldId = 5
|
||||
goto WriteFieldError
|
||||
}
|
||||
}
|
||||
if err = oprot.WriteFieldStop(); err != nil {
|
||||
goto WriteFieldStopError
|
||||
}
|
||||
if err = oprot.WriteStructEnd(); err != nil {
|
||||
goto WriteStructEndError
|
||||
}
|
||||
return nil
|
||||
WriteStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
||||
WriteFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
||||
WriteFieldStopError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
||||
WriteStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *CaseDataBase) writeField1(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetCaseID() {
|
||||
if err = oprot.WriteFieldBegin("caseID", thrift.I64, 1); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteI64(*p.CaseID); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
|
||||
}
|
||||
func (p *CaseDataBase) writeField2(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetName() {
|
||||
if err = oprot.WriteFieldBegin("name", thrift.STRING, 2); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteString(*p.Name); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err)
|
||||
}
|
||||
func (p *CaseDataBase) writeField3(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetDescription() {
|
||||
if err = oprot.WriteFieldBegin("description", thrift.STRING, 3); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteString(*p.Description); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err)
|
||||
}
|
||||
func (p *CaseDataBase) writeField4(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetInput() {
|
||||
if err = oprot.WriteFieldBegin("input", thrift.STRING, 4); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteString(*p.Input); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err)
|
||||
}
|
||||
func (p *CaseDataBase) writeField5(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetIsDefault() {
|
||||
if err = oprot.WriteFieldBegin("isDefault", thrift.BOOL, 5); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteBool(*p.IsDefault); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *CaseDataBase) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("CaseDataBase(%+v)", *p)
|
||||
|
||||
}
|
||||
|
||||
type CaseDataDetail struct {
|
||||
CaseBase *CaseDataBase `thrift:"caseBase,1,optional" form:"caseBase" json:"caseBase,omitempty" query:"caseBase"`
|
||||
CreatorID *string `thrift:"creatorID,2,optional" form:"creatorID" json:"creatorID,omitempty" query:"creatorID"`
|
||||
CreateTimeInSec *int64 `thrift:"createTimeInSec,3,optional" form:"createTimeInSec" json:"createTimeInSec,omitempty" query:"createTimeInSec"`
|
||||
UpdateTimeInSec *int64 `thrift:"updateTimeInSec,4,optional" form:"updateTimeInSec" json:"updateTimeInSec,omitempty" query:"updateTimeInSec"`
|
||||
// Schema incompatibility
|
||||
SchemaIncompatible *bool `thrift:"schemaIncompatible,5,optional" form:"schemaIncompatible" json:"schemaIncompatible,omitempty" query:"schemaIncompatible"`
|
||||
Updater *infra.Creator `thrift:"updater,6,optional" form:"updater" json:"updater,omitempty" query:"updater"`
|
||||
}
|
||||
|
||||
func NewCaseDataDetail() *CaseDataDetail {
|
||||
return &CaseDataDetail{}
|
||||
}
|
||||
|
||||
func (p *CaseDataDetail) InitDefault() {
|
||||
}
|
||||
|
||||
var CaseDataDetail_CaseBase_DEFAULT *CaseDataBase
|
||||
|
||||
func (p *CaseDataDetail) GetCaseBase() (v *CaseDataBase) {
|
||||
if !p.IsSetCaseBase() {
|
||||
return CaseDataDetail_CaseBase_DEFAULT
|
||||
}
|
||||
return p.CaseBase
|
||||
}
|
||||
|
||||
var CaseDataDetail_CreatorID_DEFAULT string
|
||||
|
||||
func (p *CaseDataDetail) GetCreatorID() (v string) {
|
||||
if !p.IsSetCreatorID() {
|
||||
return CaseDataDetail_CreatorID_DEFAULT
|
||||
}
|
||||
return *p.CreatorID
|
||||
}
|
||||
|
||||
var CaseDataDetail_CreateTimeInSec_DEFAULT int64
|
||||
|
||||
func (p *CaseDataDetail) GetCreateTimeInSec() (v int64) {
|
||||
if !p.IsSetCreateTimeInSec() {
|
||||
return CaseDataDetail_CreateTimeInSec_DEFAULT
|
||||
}
|
||||
return *p.CreateTimeInSec
|
||||
}
|
||||
|
||||
var CaseDataDetail_UpdateTimeInSec_DEFAULT int64
|
||||
|
||||
func (p *CaseDataDetail) GetUpdateTimeInSec() (v int64) {
|
||||
if !p.IsSetUpdateTimeInSec() {
|
||||
return CaseDataDetail_UpdateTimeInSec_DEFAULT
|
||||
}
|
||||
return *p.UpdateTimeInSec
|
||||
}
|
||||
|
||||
var CaseDataDetail_SchemaIncompatible_DEFAULT bool
|
||||
|
||||
func (p *CaseDataDetail) GetSchemaIncompatible() (v bool) {
|
||||
if !p.IsSetSchemaIncompatible() {
|
||||
return CaseDataDetail_SchemaIncompatible_DEFAULT
|
||||
}
|
||||
return *p.SchemaIncompatible
|
||||
}
|
||||
|
||||
var CaseDataDetail_Updater_DEFAULT *infra.Creator
|
||||
|
||||
func (p *CaseDataDetail) GetUpdater() (v *infra.Creator) {
|
||||
if !p.IsSetUpdater() {
|
||||
return CaseDataDetail_Updater_DEFAULT
|
||||
}
|
||||
return p.Updater
|
||||
}
|
||||
|
||||
var fieldIDToName_CaseDataDetail = map[int16]string{
|
||||
1: "caseBase",
|
||||
2: "creatorID",
|
||||
3: "createTimeInSec",
|
||||
4: "updateTimeInSec",
|
||||
5: "schemaIncompatible",
|
||||
6: "updater",
|
||||
}
|
||||
|
||||
func (p *CaseDataDetail) IsSetCaseBase() bool {
|
||||
return p.CaseBase != nil
|
||||
}
|
||||
|
||||
func (p *CaseDataDetail) IsSetCreatorID() bool {
|
||||
return p.CreatorID != nil
|
||||
}
|
||||
|
||||
func (p *CaseDataDetail) IsSetCreateTimeInSec() bool {
|
||||
return p.CreateTimeInSec != nil
|
||||
}
|
||||
|
||||
func (p *CaseDataDetail) IsSetUpdateTimeInSec() bool {
|
||||
return p.UpdateTimeInSec != nil
|
||||
}
|
||||
|
||||
func (p *CaseDataDetail) IsSetSchemaIncompatible() bool {
|
||||
return p.SchemaIncompatible != nil
|
||||
}
|
||||
|
||||
func (p *CaseDataDetail) IsSetUpdater() bool {
|
||||
return p.Updater != nil
|
||||
}
|
||||
|
||||
func (p *CaseDataDetail) Read(iprot thrift.TProtocol) (err error) {
|
||||
var fieldTypeId thrift.TType
|
||||
var fieldId int16
|
||||
|
||||
if _, err = iprot.ReadStructBegin(); err != nil {
|
||||
goto ReadStructBeginError
|
||||
}
|
||||
|
||||
for {
|
||||
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
||||
if err != nil {
|
||||
goto ReadFieldBeginError
|
||||
}
|
||||
if fieldTypeId == thrift.STOP {
|
||||
break
|
||||
}
|
||||
|
||||
switch fieldId {
|
||||
case 1:
|
||||
if fieldTypeId == thrift.STRUCT {
|
||||
if err = p.ReadField1(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 2:
|
||||
if fieldTypeId == thrift.STRING {
|
||||
if err = p.ReadField2(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 3:
|
||||
if fieldTypeId == thrift.I64 {
|
||||
if err = p.ReadField3(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 4:
|
||||
if fieldTypeId == thrift.I64 {
|
||||
if err = p.ReadField4(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 5:
|
||||
if fieldTypeId == thrift.BOOL {
|
||||
if err = p.ReadField5(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 6:
|
||||
if fieldTypeId == thrift.STRUCT {
|
||||
if err = p.ReadField6(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
default:
|
||||
if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadFieldEnd(); err != nil {
|
||||
goto ReadFieldEndError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadStructEnd(); err != nil {
|
||||
goto ReadStructEndError
|
||||
}
|
||||
|
||||
return nil
|
||||
ReadStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
||||
ReadFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
||||
ReadFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_CaseDataDetail[fieldId]), err)
|
||||
SkipFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
||||
|
||||
ReadFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
||||
ReadStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *CaseDataDetail) ReadField1(iprot thrift.TProtocol) error {
|
||||
_field := NewCaseDataBase()
|
||||
if err := _field.Read(iprot); err != nil {
|
||||
return err
|
||||
}
|
||||
p.CaseBase = _field
|
||||
return nil
|
||||
}
|
||||
func (p *CaseDataDetail) ReadField2(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field *string
|
||||
if v, err := iprot.ReadString(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = &v
|
||||
}
|
||||
p.CreatorID = _field
|
||||
return nil
|
||||
}
|
||||
func (p *CaseDataDetail) ReadField3(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field *int64
|
||||
if v, err := iprot.ReadI64(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = &v
|
||||
}
|
||||
p.CreateTimeInSec = _field
|
||||
return nil
|
||||
}
|
||||
func (p *CaseDataDetail) ReadField4(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field *int64
|
||||
if v, err := iprot.ReadI64(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = &v
|
||||
}
|
||||
p.UpdateTimeInSec = _field
|
||||
return nil
|
||||
}
|
||||
func (p *CaseDataDetail) ReadField5(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field *bool
|
||||
if v, err := iprot.ReadBool(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = &v
|
||||
}
|
||||
p.SchemaIncompatible = _field
|
||||
return nil
|
||||
}
|
||||
func (p *CaseDataDetail) ReadField6(iprot thrift.TProtocol) error {
|
||||
_field := infra.NewCreator()
|
||||
if err := _field.Read(iprot); err != nil {
|
||||
return err
|
||||
}
|
||||
p.Updater = _field
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *CaseDataDetail) Write(oprot thrift.TProtocol) (err error) {
|
||||
var fieldId int16
|
||||
if err = oprot.WriteStructBegin("CaseDataDetail"); err != nil {
|
||||
goto WriteStructBeginError
|
||||
}
|
||||
if p != nil {
|
||||
if err = p.writeField1(oprot); err != nil {
|
||||
fieldId = 1
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField2(oprot); err != nil {
|
||||
fieldId = 2
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField3(oprot); err != nil {
|
||||
fieldId = 3
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField4(oprot); err != nil {
|
||||
fieldId = 4
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField5(oprot); err != nil {
|
||||
fieldId = 5
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField6(oprot); err != nil {
|
||||
fieldId = 6
|
||||
goto WriteFieldError
|
||||
}
|
||||
}
|
||||
if err = oprot.WriteFieldStop(); err != nil {
|
||||
goto WriteFieldStopError
|
||||
}
|
||||
if err = oprot.WriteStructEnd(); err != nil {
|
||||
goto WriteStructEndError
|
||||
}
|
||||
return nil
|
||||
WriteStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
||||
WriteFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
||||
WriteFieldStopError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
||||
WriteStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *CaseDataDetail) writeField1(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetCaseBase() {
|
||||
if err = oprot.WriteFieldBegin("caseBase", thrift.STRUCT, 1); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := p.CaseBase.Write(oprot); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
|
||||
}
|
||||
func (p *CaseDataDetail) writeField2(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetCreatorID() {
|
||||
if err = oprot.WriteFieldBegin("creatorID", thrift.STRING, 2); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteString(*p.CreatorID); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err)
|
||||
}
|
||||
func (p *CaseDataDetail) writeField3(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetCreateTimeInSec() {
|
||||
if err = oprot.WriteFieldBegin("createTimeInSec", thrift.I64, 3); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteI64(*p.CreateTimeInSec); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 3 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 3 end error: ", p), err)
|
||||
}
|
||||
func (p *CaseDataDetail) writeField4(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetUpdateTimeInSec() {
|
||||
if err = oprot.WriteFieldBegin("updateTimeInSec", thrift.I64, 4); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteI64(*p.UpdateTimeInSec); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 4 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 4 end error: ", p), err)
|
||||
}
|
||||
func (p *CaseDataDetail) writeField5(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetSchemaIncompatible() {
|
||||
if err = oprot.WriteFieldBegin("schemaIncompatible", thrift.BOOL, 5); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteBool(*p.SchemaIncompatible); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 5 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err)
|
||||
}
|
||||
func (p *CaseDataDetail) writeField6(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetUpdater() {
|
||||
if err = oprot.WriteFieldBegin("updater", thrift.STRUCT, 6); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := p.Updater.Write(oprot); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *CaseDataDetail) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("CaseDataDetail(%+v)", *p)
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -7,7 +7,7 @@ import (
|
||||
"database/sql/driver"
|
||||
"fmt"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/flow/marketplace/marketplace_common"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/marketplace/marketplace_common"
|
||||
)
|
||||
|
||||
type ProductEntityType int64
|
||||
@ -9,8 +9,8 @@ import (
|
||||
"fmt"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/base"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/flow/marketplace/marketplace_common"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/flow/marketplace/product_common"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/marketplace/marketplace_common"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/marketplace/product_common"
|
||||
)
|
||||
|
||||
type PluginAuthMode int64
|
||||
@ -1,768 +0,0 @@
|
||||
// Code generated by thriftgo (0.4.1). DO NOT EDIT.
|
||||
|
||||
package bot_open_api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/apache/thrift/lib/go/thrift"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/base"
|
||||
)
|
||||
|
||||
type OauthAuthorizationCodeReq struct {
|
||||
Code string `thrift:"code,1" json:"code" query:"code"`
|
||||
State string `thrift:"state,2" json:"state" query:"state"`
|
||||
}
|
||||
|
||||
func NewOauthAuthorizationCodeReq() *OauthAuthorizationCodeReq {
|
||||
return &OauthAuthorizationCodeReq{}
|
||||
}
|
||||
|
||||
func (p *OauthAuthorizationCodeReq) InitDefault() {
|
||||
}
|
||||
|
||||
func (p *OauthAuthorizationCodeReq) GetCode() (v string) {
|
||||
return p.Code
|
||||
}
|
||||
|
||||
func (p *OauthAuthorizationCodeReq) GetState() (v string) {
|
||||
return p.State
|
||||
}
|
||||
|
||||
var fieldIDToName_OauthAuthorizationCodeReq = map[int16]string{
|
||||
1: "code",
|
||||
2: "state",
|
||||
}
|
||||
|
||||
func (p *OauthAuthorizationCodeReq) Read(iprot thrift.TProtocol) (err error) {
|
||||
var fieldTypeId thrift.TType
|
||||
var fieldId int16
|
||||
|
||||
if _, err = iprot.ReadStructBegin(); err != nil {
|
||||
goto ReadStructBeginError
|
||||
}
|
||||
|
||||
for {
|
||||
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
||||
if err != nil {
|
||||
goto ReadFieldBeginError
|
||||
}
|
||||
if fieldTypeId == thrift.STOP {
|
||||
break
|
||||
}
|
||||
|
||||
switch fieldId {
|
||||
case 1:
|
||||
if fieldTypeId == thrift.STRING {
|
||||
if err = p.ReadField1(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 2:
|
||||
if fieldTypeId == thrift.STRING {
|
||||
if err = p.ReadField2(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
default:
|
||||
if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadFieldEnd(); err != nil {
|
||||
goto ReadFieldEndError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadStructEnd(); err != nil {
|
||||
goto ReadStructEndError
|
||||
}
|
||||
|
||||
return nil
|
||||
ReadStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
||||
ReadFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
||||
ReadFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_OauthAuthorizationCodeReq[fieldId]), err)
|
||||
SkipFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
||||
|
||||
ReadFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
||||
ReadStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *OauthAuthorizationCodeReq) ReadField1(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field string
|
||||
if v, err := iprot.ReadString(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = v
|
||||
}
|
||||
p.Code = _field
|
||||
return nil
|
||||
}
|
||||
func (p *OauthAuthorizationCodeReq) ReadField2(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field string
|
||||
if v, err := iprot.ReadString(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = v
|
||||
}
|
||||
p.State = _field
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *OauthAuthorizationCodeReq) Write(oprot thrift.TProtocol) (err error) {
|
||||
var fieldId int16
|
||||
if err = oprot.WriteStructBegin("OauthAuthorizationCodeReq"); err != nil {
|
||||
goto WriteStructBeginError
|
||||
}
|
||||
if p != nil {
|
||||
if err = p.writeField1(oprot); err != nil {
|
||||
fieldId = 1
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField2(oprot); err != nil {
|
||||
fieldId = 2
|
||||
goto WriteFieldError
|
||||
}
|
||||
}
|
||||
if err = oprot.WriteFieldStop(); err != nil {
|
||||
goto WriteFieldStopError
|
||||
}
|
||||
if err = oprot.WriteStructEnd(); err != nil {
|
||||
goto WriteStructEndError
|
||||
}
|
||||
return nil
|
||||
WriteStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
||||
WriteFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
||||
WriteFieldStopError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
||||
WriteStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *OauthAuthorizationCodeReq) writeField1(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("code", thrift.STRING, 1); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteString(p.Code); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
|
||||
}
|
||||
func (p *OauthAuthorizationCodeReq) writeField2(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("state", thrift.STRING, 2); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteString(p.State); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 2 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 2 end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *OauthAuthorizationCodeReq) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("OauthAuthorizationCodeReq(%+v)", *p)
|
||||
|
||||
}
|
||||
|
||||
type OauthAuthorizationCodeResp struct {
|
||||
BaseResp *base.BaseResp `thrift:"BaseResp,255,required" form:"BaseResp,required" json:"BaseResp,required" query:"BaseResp,required"`
|
||||
}
|
||||
|
||||
func NewOauthAuthorizationCodeResp() *OauthAuthorizationCodeResp {
|
||||
return &OauthAuthorizationCodeResp{}
|
||||
}
|
||||
|
||||
func (p *OauthAuthorizationCodeResp) InitDefault() {
|
||||
}
|
||||
|
||||
var OauthAuthorizationCodeResp_BaseResp_DEFAULT *base.BaseResp
|
||||
|
||||
func (p *OauthAuthorizationCodeResp) GetBaseResp() (v *base.BaseResp) {
|
||||
if !p.IsSetBaseResp() {
|
||||
return OauthAuthorizationCodeResp_BaseResp_DEFAULT
|
||||
}
|
||||
return p.BaseResp
|
||||
}
|
||||
|
||||
var fieldIDToName_OauthAuthorizationCodeResp = map[int16]string{
|
||||
255: "BaseResp",
|
||||
}
|
||||
|
||||
func (p *OauthAuthorizationCodeResp) IsSetBaseResp() bool {
|
||||
return p.BaseResp != nil
|
||||
}
|
||||
|
||||
func (p *OauthAuthorizationCodeResp) Read(iprot thrift.TProtocol) (err error) {
|
||||
var fieldTypeId thrift.TType
|
||||
var fieldId int16
|
||||
var issetBaseResp bool = false
|
||||
|
||||
if _, err = iprot.ReadStructBegin(); err != nil {
|
||||
goto ReadStructBeginError
|
||||
}
|
||||
|
||||
for {
|
||||
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
||||
if err != nil {
|
||||
goto ReadFieldBeginError
|
||||
}
|
||||
if fieldTypeId == thrift.STOP {
|
||||
break
|
||||
}
|
||||
|
||||
switch fieldId {
|
||||
case 255:
|
||||
if fieldTypeId == thrift.STRUCT {
|
||||
if err = p.ReadField255(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
issetBaseResp = true
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
default:
|
||||
if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadFieldEnd(); err != nil {
|
||||
goto ReadFieldEndError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadStructEnd(); err != nil {
|
||||
goto ReadStructEndError
|
||||
}
|
||||
|
||||
if !issetBaseResp {
|
||||
fieldId = 255
|
||||
goto RequiredFieldNotSetError
|
||||
}
|
||||
return nil
|
||||
ReadStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
||||
ReadFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
||||
ReadFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_OauthAuthorizationCodeResp[fieldId]), err)
|
||||
SkipFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
||||
|
||||
ReadFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
||||
ReadStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
||||
RequiredFieldNotSetError:
|
||||
return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("required field %s is not set", fieldIDToName_OauthAuthorizationCodeResp[fieldId]))
|
||||
}
|
||||
|
||||
func (p *OauthAuthorizationCodeResp) ReadField255(iprot thrift.TProtocol) error {
|
||||
_field := base.NewBaseResp()
|
||||
if err := _field.Read(iprot); err != nil {
|
||||
return err
|
||||
}
|
||||
p.BaseResp = _field
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *OauthAuthorizationCodeResp) Write(oprot thrift.TProtocol) (err error) {
|
||||
var fieldId int16
|
||||
if err = oprot.WriteStructBegin("OauthAuthorizationCodeResp"); err != nil {
|
||||
goto WriteStructBeginError
|
||||
}
|
||||
if p != nil {
|
||||
if err = p.writeField255(oprot); err != nil {
|
||||
fieldId = 255
|
||||
goto WriteFieldError
|
||||
}
|
||||
}
|
||||
if err = oprot.WriteFieldStop(); err != nil {
|
||||
goto WriteFieldStopError
|
||||
}
|
||||
if err = oprot.WriteStructEnd(); err != nil {
|
||||
goto WriteStructEndError
|
||||
}
|
||||
return nil
|
||||
WriteStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
||||
WriteFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
||||
WriteFieldStopError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
||||
WriteStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *OauthAuthorizationCodeResp) writeField255(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("BaseResp", thrift.STRUCT, 255); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := p.BaseResp.Write(oprot); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 255 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 255 end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *OauthAuthorizationCodeResp) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("OauthAuthorizationCodeResp(%+v)", *p)
|
||||
|
||||
}
|
||||
|
||||
type BotOpenApiService interface {
|
||||
OauthAuthorizationCode(ctx context.Context, request *OauthAuthorizationCodeReq) (r *OauthAuthorizationCodeResp, err error)
|
||||
}
|
||||
|
||||
type BotOpenApiServiceClient struct {
|
||||
c thrift.TClient
|
||||
}
|
||||
|
||||
func NewBotOpenApiServiceClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *BotOpenApiServiceClient {
|
||||
return &BotOpenApiServiceClient{
|
||||
c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)),
|
||||
}
|
||||
}
|
||||
|
||||
func NewBotOpenApiServiceClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *BotOpenApiServiceClient {
|
||||
return &BotOpenApiServiceClient{
|
||||
c: thrift.NewTStandardClient(iprot, oprot),
|
||||
}
|
||||
}
|
||||
|
||||
func NewBotOpenApiServiceClient(c thrift.TClient) *BotOpenApiServiceClient {
|
||||
return &BotOpenApiServiceClient{
|
||||
c: c,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *BotOpenApiServiceClient) Client_() thrift.TClient {
|
||||
return p.c
|
||||
}
|
||||
|
||||
func (p *BotOpenApiServiceClient) OauthAuthorizationCode(ctx context.Context, request *OauthAuthorizationCodeReq) (r *OauthAuthorizationCodeResp, err error) {
|
||||
var _args BotOpenApiServiceOauthAuthorizationCodeArgs
|
||||
_args.Request = request
|
||||
var _result BotOpenApiServiceOauthAuthorizationCodeResult
|
||||
if err = p.Client_().Call(ctx, "OauthAuthorizationCode", &_args, &_result); err != nil {
|
||||
return
|
||||
}
|
||||
return _result.GetSuccess(), nil
|
||||
}
|
||||
|
||||
type BotOpenApiServiceProcessor struct {
|
||||
processorMap map[string]thrift.TProcessorFunction
|
||||
handler BotOpenApiService
|
||||
}
|
||||
|
||||
func (p *BotOpenApiServiceProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {
|
||||
p.processorMap[key] = processor
|
||||
}
|
||||
|
||||
func (p *BotOpenApiServiceProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) {
|
||||
processor, ok = p.processorMap[key]
|
||||
return processor, ok
|
||||
}
|
||||
|
||||
func (p *BotOpenApiServiceProcessor) ProcessorMap() map[string]thrift.TProcessorFunction {
|
||||
return p.processorMap
|
||||
}
|
||||
|
||||
func NewBotOpenApiServiceProcessor(handler BotOpenApiService) *BotOpenApiServiceProcessor {
|
||||
self := &BotOpenApiServiceProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)}
|
||||
self.AddToProcessorMap("OauthAuthorizationCode", &botOpenApiServiceProcessorOauthAuthorizationCode{handler: handler})
|
||||
return self
|
||||
}
|
||||
func (p *BotOpenApiServiceProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
|
||||
name, _, seqId, err := iprot.ReadMessageBegin()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if processor, ok := p.GetProcessorFunction(name); ok {
|
||||
return processor.Process(ctx, seqId, iprot, oprot)
|
||||
}
|
||||
iprot.Skip(thrift.STRUCT)
|
||||
iprot.ReadMessageEnd()
|
||||
x := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name)
|
||||
oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId)
|
||||
x.Write(oprot)
|
||||
oprot.WriteMessageEnd()
|
||||
oprot.Flush(ctx)
|
||||
return false, x
|
||||
}
|
||||
|
||||
type botOpenApiServiceProcessorOauthAuthorizationCode struct {
|
||||
handler BotOpenApiService
|
||||
}
|
||||
|
||||
func (p *botOpenApiServiceProcessorOauthAuthorizationCode) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
|
||||
args := BotOpenApiServiceOauthAuthorizationCodeArgs{}
|
||||
if err = args.Read(iprot); err != nil {
|
||||
iprot.ReadMessageEnd()
|
||||
x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
|
||||
oprot.WriteMessageBegin("OauthAuthorizationCode", thrift.EXCEPTION, seqId)
|
||||
x.Write(oprot)
|
||||
oprot.WriteMessageEnd()
|
||||
oprot.Flush(ctx)
|
||||
return false, err
|
||||
}
|
||||
|
||||
iprot.ReadMessageEnd()
|
||||
var err2 error
|
||||
result := BotOpenApiServiceOauthAuthorizationCodeResult{}
|
||||
var retval *OauthAuthorizationCodeResp
|
||||
if retval, err2 = p.handler.OauthAuthorizationCode(ctx, args.Request); err2 != nil {
|
||||
x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing OauthAuthorizationCode: "+err2.Error())
|
||||
oprot.WriteMessageBegin("OauthAuthorizationCode", thrift.EXCEPTION, seqId)
|
||||
x.Write(oprot)
|
||||
oprot.WriteMessageEnd()
|
||||
oprot.Flush(ctx)
|
||||
return true, err2
|
||||
} else {
|
||||
result.Success = retval
|
||||
}
|
||||
if err2 = oprot.WriteMessageBegin("OauthAuthorizationCode", thrift.REPLY, seqId); err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err2 = result.Write(oprot); err == nil && err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
|
||||
err = err2
|
||||
}
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return true, err
|
||||
}
|
||||
|
||||
type BotOpenApiServiceOauthAuthorizationCodeArgs struct {
|
||||
Request *OauthAuthorizationCodeReq `thrift:"request,1"`
|
||||
}
|
||||
|
||||
func NewBotOpenApiServiceOauthAuthorizationCodeArgs() *BotOpenApiServiceOauthAuthorizationCodeArgs {
|
||||
return &BotOpenApiServiceOauthAuthorizationCodeArgs{}
|
||||
}
|
||||
|
||||
func (p *BotOpenApiServiceOauthAuthorizationCodeArgs) InitDefault() {
|
||||
}
|
||||
|
||||
var BotOpenApiServiceOauthAuthorizationCodeArgs_Request_DEFAULT *OauthAuthorizationCodeReq
|
||||
|
||||
func (p *BotOpenApiServiceOauthAuthorizationCodeArgs) GetRequest() (v *OauthAuthorizationCodeReq) {
|
||||
if !p.IsSetRequest() {
|
||||
return BotOpenApiServiceOauthAuthorizationCodeArgs_Request_DEFAULT
|
||||
}
|
||||
return p.Request
|
||||
}
|
||||
|
||||
var fieldIDToName_BotOpenApiServiceOauthAuthorizationCodeArgs = map[int16]string{
|
||||
1: "request",
|
||||
}
|
||||
|
||||
func (p *BotOpenApiServiceOauthAuthorizationCodeArgs) IsSetRequest() bool {
|
||||
return p.Request != nil
|
||||
}
|
||||
|
||||
func (p *BotOpenApiServiceOauthAuthorizationCodeArgs) Read(iprot thrift.TProtocol) (err error) {
|
||||
var fieldTypeId thrift.TType
|
||||
var fieldId int16
|
||||
|
||||
if _, err = iprot.ReadStructBegin(); err != nil {
|
||||
goto ReadStructBeginError
|
||||
}
|
||||
|
||||
for {
|
||||
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
||||
if err != nil {
|
||||
goto ReadFieldBeginError
|
||||
}
|
||||
if fieldTypeId == thrift.STOP {
|
||||
break
|
||||
}
|
||||
|
||||
switch fieldId {
|
||||
case 1:
|
||||
if fieldTypeId == thrift.STRUCT {
|
||||
if err = p.ReadField1(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
default:
|
||||
if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadFieldEnd(); err != nil {
|
||||
goto ReadFieldEndError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadStructEnd(); err != nil {
|
||||
goto ReadStructEndError
|
||||
}
|
||||
|
||||
return nil
|
||||
ReadStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
||||
ReadFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
||||
ReadFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_BotOpenApiServiceOauthAuthorizationCodeArgs[fieldId]), err)
|
||||
SkipFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
||||
|
||||
ReadFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
||||
ReadStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *BotOpenApiServiceOauthAuthorizationCodeArgs) ReadField1(iprot thrift.TProtocol) error {
|
||||
_field := NewOauthAuthorizationCodeReq()
|
||||
if err := _field.Read(iprot); err != nil {
|
||||
return err
|
||||
}
|
||||
p.Request = _field
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *BotOpenApiServiceOauthAuthorizationCodeArgs) Write(oprot thrift.TProtocol) (err error) {
|
||||
var fieldId int16
|
||||
if err = oprot.WriteStructBegin("OauthAuthorizationCode_args"); err != nil {
|
||||
goto WriteStructBeginError
|
||||
}
|
||||
if p != nil {
|
||||
if err = p.writeField1(oprot); err != nil {
|
||||
fieldId = 1
|
||||
goto WriteFieldError
|
||||
}
|
||||
}
|
||||
if err = oprot.WriteFieldStop(); err != nil {
|
||||
goto WriteFieldStopError
|
||||
}
|
||||
if err = oprot.WriteStructEnd(); err != nil {
|
||||
goto WriteStructEndError
|
||||
}
|
||||
return nil
|
||||
WriteStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
||||
WriteFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
||||
WriteFieldStopError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
||||
WriteStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *BotOpenApiServiceOauthAuthorizationCodeArgs) writeField1(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("request", thrift.STRUCT, 1); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := p.Request.Write(oprot); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 1 end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *BotOpenApiServiceOauthAuthorizationCodeArgs) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("BotOpenApiServiceOauthAuthorizationCodeArgs(%+v)", *p)
|
||||
|
||||
}
|
||||
|
||||
type BotOpenApiServiceOauthAuthorizationCodeResult struct {
|
||||
Success *OauthAuthorizationCodeResp `thrift:"success,0,optional"`
|
||||
}
|
||||
|
||||
func NewBotOpenApiServiceOauthAuthorizationCodeResult() *BotOpenApiServiceOauthAuthorizationCodeResult {
|
||||
return &BotOpenApiServiceOauthAuthorizationCodeResult{}
|
||||
}
|
||||
|
||||
func (p *BotOpenApiServiceOauthAuthorizationCodeResult) InitDefault() {
|
||||
}
|
||||
|
||||
var BotOpenApiServiceOauthAuthorizationCodeResult_Success_DEFAULT *OauthAuthorizationCodeResp
|
||||
|
||||
func (p *BotOpenApiServiceOauthAuthorizationCodeResult) GetSuccess() (v *OauthAuthorizationCodeResp) {
|
||||
if !p.IsSetSuccess() {
|
||||
return BotOpenApiServiceOauthAuthorizationCodeResult_Success_DEFAULT
|
||||
}
|
||||
return p.Success
|
||||
}
|
||||
|
||||
var fieldIDToName_BotOpenApiServiceOauthAuthorizationCodeResult = map[int16]string{
|
||||
0: "success",
|
||||
}
|
||||
|
||||
func (p *BotOpenApiServiceOauthAuthorizationCodeResult) IsSetSuccess() bool {
|
||||
return p.Success != nil
|
||||
}
|
||||
|
||||
func (p *BotOpenApiServiceOauthAuthorizationCodeResult) Read(iprot thrift.TProtocol) (err error) {
|
||||
var fieldTypeId thrift.TType
|
||||
var fieldId int16
|
||||
|
||||
if _, err = iprot.ReadStructBegin(); err != nil {
|
||||
goto ReadStructBeginError
|
||||
}
|
||||
|
||||
for {
|
||||
_, fieldTypeId, fieldId, err = iprot.ReadFieldBegin()
|
||||
if err != nil {
|
||||
goto ReadFieldBeginError
|
||||
}
|
||||
if fieldTypeId == thrift.STOP {
|
||||
break
|
||||
}
|
||||
|
||||
switch fieldId {
|
||||
case 0:
|
||||
if fieldTypeId == thrift.STRUCT {
|
||||
if err = p.ReadField0(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
default:
|
||||
if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadFieldEnd(); err != nil {
|
||||
goto ReadFieldEndError
|
||||
}
|
||||
}
|
||||
if err = iprot.ReadStructEnd(); err != nil {
|
||||
goto ReadStructEndError
|
||||
}
|
||||
|
||||
return nil
|
||||
ReadStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct begin error: ", p), err)
|
||||
ReadFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d begin error: ", p, fieldId), err)
|
||||
ReadFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field %d '%s' error: ", p, fieldId, fieldIDToName_BotOpenApiServiceOauthAuthorizationCodeResult[fieldId]), err)
|
||||
SkipFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T field %d skip type %d error: ", p, fieldId, fieldTypeId), err)
|
||||
|
||||
ReadFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read field end error", p), err)
|
||||
ReadStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *BotOpenApiServiceOauthAuthorizationCodeResult) ReadField0(iprot thrift.TProtocol) error {
|
||||
_field := NewOauthAuthorizationCodeResp()
|
||||
if err := _field.Read(iprot); err != nil {
|
||||
return err
|
||||
}
|
||||
p.Success = _field
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *BotOpenApiServiceOauthAuthorizationCodeResult) Write(oprot thrift.TProtocol) (err error) {
|
||||
var fieldId int16
|
||||
if err = oprot.WriteStructBegin("OauthAuthorizationCode_result"); err != nil {
|
||||
goto WriteStructBeginError
|
||||
}
|
||||
if p != nil {
|
||||
if err = p.writeField0(oprot); err != nil {
|
||||
fieldId = 0
|
||||
goto WriteFieldError
|
||||
}
|
||||
}
|
||||
if err = oprot.WriteFieldStop(); err != nil {
|
||||
goto WriteFieldStopError
|
||||
}
|
||||
if err = oprot.WriteStructEnd(); err != nil {
|
||||
goto WriteStructEndError
|
||||
}
|
||||
return nil
|
||||
WriteStructBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
|
||||
WriteFieldError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field %d error: ", p, fieldId), err)
|
||||
WriteFieldStopError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", p), err)
|
||||
WriteStructEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *BotOpenApiServiceOauthAuthorizationCodeResult) writeField0(oprot thrift.TProtocol) (err error) {
|
||||
if p.IsSetSuccess() {
|
||||
if err = oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := p.Success.Write(oprot); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 0 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 0 end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *BotOpenApiServiceOauthAuthorizationCodeResult) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return fmt.Sprintf("BotOpenApiServiceOauthAuthorizationCodeResult(%+v)", *p)
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
// Code generated by thriftgo (0.4.1). DO NOT EDIT.
|
||||
|
||||
package plugin_develop_common
|
||||
package common
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
File diff suppressed because it is too large
Load Diff
@ -26,21 +26,21 @@ import (
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
intelligenceAPI "github.com/coze-dev/coze-studio/backend/api/model/app/intelligence"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/app/intelligence/common"
|
||||
taskStruct "github.com/coze-dev/coze-studio/backend/api/model/app/intelligence/common"
|
||||
projectAPI "github.com/coze-dev/coze-studio/backend/api/model/app/intelligence/project"
|
||||
publishAPI "github.com/coze-dev/coze-studio/backend/api/model/app/intelligence/publish"
|
||||
taskAPI "github.com/coze-dev/coze-studio/backend/api/model/app/intelligence/task"
|
||||
connectorModel "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/connector"
|
||||
knowledgeModel "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/knowledge"
|
||||
pluginModel "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/plugin"
|
||||
intelligenceAPI "github.com/coze-dev/coze-studio/backend/api/model/intelligence"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/intelligence/common"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/playground"
|
||||
workflowAPI "github.com/coze-dev/coze-studio/backend/api/model/ocean/cloud/workflow"
|
||||
projectAPI "github.com/coze-dev/coze-studio/backend/api/model/project"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/project_memory"
|
||||
publishAPI "github.com/coze-dev/coze-studio/backend/api/model/publish"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/data/database/table"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/data/variable/project_memory"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/playground"
|
||||
resourceAPI "github.com/coze-dev/coze-studio/backend/api/model/resource"
|
||||
resourceCommon "github.com/coze-dev/coze-studio/backend/api/model/resource/common"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/table"
|
||||
taskAPI "github.com/coze-dev/coze-studio/backend/api/model/task"
|
||||
taskStruct "github.com/coze-dev/coze-studio/backend/api/model/task_struct"
|
||||
workflowAPI "github.com/coze-dev/coze-studio/backend/api/model/workflow"
|
||||
"github.com/coze-dev/coze-studio/backend/application/base/ctxutil"
|
||||
"github.com/coze-dev/coze-studio/backend/application/knowledge"
|
||||
"github.com/coze-dev/coze-studio/backend/application/memory"
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
redisV9 "github.com/redis/go-redis/v9"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/domain/app/repository"
|
||||
@ -26,6 +25,7 @@ import (
|
||||
variables "github.com/coze-dev/coze-studio/backend/domain/memory/variables/service"
|
||||
search "github.com/coze-dev/coze-studio/backend/domain/search/service"
|
||||
user "github.com/coze-dev/coze-studio/backend/domain/user/service"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/cache"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/idgen"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/modelmgr"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/storage"
|
||||
@ -35,7 +35,7 @@ type ServiceComponents struct {
|
||||
IDGen idgen.IDGenerator
|
||||
DB *gorm.DB
|
||||
OSS storage.Storage
|
||||
CacheCli *redisV9.Client
|
||||
CacheCli cache.Cmdable
|
||||
ProjectEventBus search.ProjectEventBus
|
||||
|
||||
ModelMgr modelmgr.Manager
|
||||
|
||||
@ -20,11 +20,9 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/cloudwego/hertz/pkg/route"
|
||||
"github.com/coze-dev/coze-studio/backend/application/openauth"
|
||||
"github.com/coze-dev/coze-studio/backend/application/template"
|
||||
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/crosssearch"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/logs"
|
||||
crosssearch "github.com/coze-dev/coze-studio/backend/crossdomain/contract/search"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/application/app"
|
||||
"github.com/coze-dev/coze-studio/backend/application/base/appinfra"
|
||||
@ -41,18 +39,19 @@ import (
|
||||
"github.com/coze-dev/coze-studio/backend/application/upload"
|
||||
"github.com/coze-dev/coze-studio/backend/application/user"
|
||||
"github.com/coze-dev/coze-studio/backend/application/workflow"
|
||||
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/crossagent"
|
||||
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/crossagentrun"
|
||||
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/crossconnector"
|
||||
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/crossconversation"
|
||||
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/crossdatabase"
|
||||
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/crossdatacopy"
|
||||
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/crossknowledge"
|
||||
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/crossmessage"
|
||||
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/crossplugin"
|
||||
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/crossuser"
|
||||
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/crossvariables"
|
||||
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/crossworkflow"
|
||||
crossagent "github.com/coze-dev/coze-studio/backend/crossdomain/contract/agent"
|
||||
crossagentrun "github.com/coze-dev/coze-studio/backend/crossdomain/contract/agentrun"
|
||||
crossconnector "github.com/coze-dev/coze-studio/backend/crossdomain/contract/connector"
|
||||
crossconversation "github.com/coze-dev/coze-studio/backend/crossdomain/contract/conversation"
|
||||
crossdatabase "github.com/coze-dev/coze-studio/backend/crossdomain/contract/database"
|
||||
crossdatacopy "github.com/coze-dev/coze-studio/backend/crossdomain/contract/datacopy"
|
||||
crossknowledge "github.com/coze-dev/coze-studio/backend/crossdomain/contract/knowledge"
|
||||
crossmessage "github.com/coze-dev/coze-studio/backend/crossdomain/contract/message"
|
||||
crossmodelmgr "github.com/coze-dev/coze-studio/backend/crossdomain/contract/modelmgr"
|
||||
crossplugin "github.com/coze-dev/coze-studio/backend/crossdomain/contract/plugin"
|
||||
crossuser "github.com/coze-dev/coze-studio/backend/crossdomain/contract/user"
|
||||
crossvariables "github.com/coze-dev/coze-studio/backend/crossdomain/contract/variables"
|
||||
crossworkflow "github.com/coze-dev/coze-studio/backend/crossdomain/contract/workflow"
|
||||
agentrunImpl "github.com/coze-dev/coze-studio/backend/crossdomain/impl/agentrun"
|
||||
connectorImpl "github.com/coze-dev/coze-studio/backend/crossdomain/impl/connector"
|
||||
conversationImpl "github.com/coze-dev/coze-studio/backend/crossdomain/impl/conversation"
|
||||
@ -61,12 +60,16 @@ import (
|
||||
dataCopyImpl "github.com/coze-dev/coze-studio/backend/crossdomain/impl/datacopy"
|
||||
knowledgeImpl "github.com/coze-dev/coze-studio/backend/crossdomain/impl/knowledge"
|
||||
messageImpl "github.com/coze-dev/coze-studio/backend/crossdomain/impl/message"
|
||||
modelmgrImpl "github.com/coze-dev/coze-studio/backend/crossdomain/impl/modelmgr"
|
||||
pluginImpl "github.com/coze-dev/coze-studio/backend/crossdomain/impl/plugin"
|
||||
searchImpl "github.com/coze-dev/coze-studio/backend/crossdomain/impl/search"
|
||||
singleagentImpl "github.com/coze-dev/coze-studio/backend/crossdomain/impl/singleagent"
|
||||
variablesImpl "github.com/coze-dev/coze-studio/backend/crossdomain/impl/variables"
|
||||
workflowImpl "github.com/coze-dev/coze-studio/backend/crossdomain/impl/workflow"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/eventbus"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/chatmodel"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/checkpoint"
|
||||
implEventbus "github.com/coze-dev/coze-studio/backend/infra/impl/eventbus"
|
||||
)
|
||||
|
||||
type eventbusImpl struct {
|
||||
@ -104,39 +107,33 @@ type complexServices struct {
|
||||
conversationSVC *conversation.ConversationApplicationService
|
||||
}
|
||||
|
||||
func Init(ctx context.Context) (shutdown []route.CtxCallback, err error) {
|
||||
func Init(ctx context.Context) (err error) {
|
||||
infra, err := appinfra.Init(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return err
|
||||
}
|
||||
|
||||
shutdown = append(shutdown, func(ctx context.Context) {
|
||||
if e := infra.TracerProvider.Shutdown(ctx); e != nil {
|
||||
logs.CtxErrorf(ctx, "shut down tracer provider failed, trace might loss, err=%v", e)
|
||||
}
|
||||
})
|
||||
|
||||
eventbus := initEventBus(infra)
|
||||
|
||||
basicServices, err := initBasicServices(ctx, infra, eventbus)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Init - initBasicServices failed, err: %v", err)
|
||||
return fmt.Errorf("Init - initBasicServices failed, err: %v", err)
|
||||
}
|
||||
|
||||
primaryServices, err := initPrimaryServices(ctx, basicServices)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Init - initPrimaryServices failed, err: %v", err)
|
||||
return fmt.Errorf("Init - initPrimaryServices failed, err: %v", err)
|
||||
}
|
||||
|
||||
complexServices, err := initComplexServices(ctx, primaryServices)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Init - initVitalServices failed, err: %v", err)
|
||||
return fmt.Errorf("Init - initVitalServices failed, err: %v", err)
|
||||
}
|
||||
|
||||
crossconnector.SetDefaultSVC(connectorImpl.InitDomainService(basicServices.connectorSVC.DomainSVC))
|
||||
crossdatabase.SetDefaultSVC(databaseImpl.InitDomainService(primaryServices.memorySVC.DatabaseDomainSVC))
|
||||
crossknowledge.SetDefaultSVC(knowledgeImpl.InitDomainService(primaryServices.knowledgeSVC.DomainSVC))
|
||||
crossplugin.SetDefaultSVC(pluginImpl.InitDomainService(primaryServices.pluginSVC.DomainSVC))
|
||||
crossplugin.SetDefaultSVC(pluginImpl.InitDomainService(primaryServices.pluginSVC.DomainSVC, infra.TOSClient))
|
||||
crossvariables.SetDefaultSVC(variablesImpl.InitDomainService(primaryServices.memorySVC.VariablesDomainSVC))
|
||||
crossworkflow.SetDefaultSVC(workflowImpl.InitDomainService(primaryServices.workflowSVC.DomainSVC))
|
||||
crossconversation.SetDefaultSVC(conversationImpl.InitDomainService(complexServices.conversationSVC.ConversationDomainSVC))
|
||||
@ -146,12 +143,14 @@ func Init(ctx context.Context) (shutdown []route.CtxCallback, err error) {
|
||||
crossuser.SetDefaultSVC(crossuserImpl.InitDomainService(basicServices.userSVC.DomainSVC))
|
||||
crossdatacopy.SetDefaultSVC(dataCopyImpl.InitDomainService(basicServices.infra))
|
||||
crosssearch.SetDefaultSVC(searchImpl.InitDomainService(complexServices.searchSVC.DomainSVC))
|
||||
crossmodelmgr.SetDefaultSVC(modelmgrImpl.InitDomainService(infra.ModelMgr, nil))
|
||||
|
||||
return shutdown, nil
|
||||
return nil
|
||||
}
|
||||
|
||||
func initEventBus(infra *appinfra.AppDependencies) *eventbusImpl {
|
||||
e := &eventbusImpl{}
|
||||
eventbus.SetDefaultSVC(implEventbus.NewConsumerService())
|
||||
e.resourceEventBus = search.NewResourceEventBus(infra.ResourceEventProducer)
|
||||
e.projectEventBus = search.NewProjectEventBus(infra.AppEventProducer)
|
||||
|
||||
@ -193,7 +192,9 @@ func initPrimaryServices(ctx context.Context, basicServices *basicServices) (*pr
|
||||
|
||||
memorySVC := memory.InitService(basicServices.toMemoryServiceComponents())
|
||||
|
||||
knowledgeSVC, err := knowledge.InitService(basicServices.toKnowledgeServiceComponents(memorySVC))
|
||||
knowledgeSVC, err := knowledge.InitService(ctx,
|
||||
basicServices.toKnowledgeServiceComponents(memorySVC),
|
||||
basicServices.eventbus.resourceEventBus)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -257,14 +258,19 @@ func (b *basicServices) toPluginServiceComponents() *plugin.ServiceComponents {
|
||||
|
||||
func (b *basicServices) toKnowledgeServiceComponents(memoryService *memory.MemoryApplicationServices) *knowledge.ServiceComponents {
|
||||
return &knowledge.ServiceComponents{
|
||||
DB: b.infra.DB,
|
||||
IDGenSVC: b.infra.IDGenSVC,
|
||||
Storage: b.infra.TOSClient,
|
||||
RDB: memoryService.RDBDomainSVC,
|
||||
ImageX: b.infra.ImageXClient,
|
||||
ES: b.infra.ESClient,
|
||||
EventBus: b.eventbus.resourceEventBus,
|
||||
CacheCli: b.infra.CacheCli,
|
||||
DB: b.infra.DB,
|
||||
IDGen: b.infra.IDGenSVC,
|
||||
RDB: memoryService.RDBDomainSVC,
|
||||
Producer: b.infra.KnowledgeEventProducer,
|
||||
SearchStoreManagers: b.infra.SearchStoreManagers,
|
||||
ParseManager: b.infra.ParserManager,
|
||||
Storage: b.infra.TOSClient,
|
||||
Rewriter: b.infra.Rewriter,
|
||||
Reranker: b.infra.Reranker,
|
||||
NL2Sql: b.infra.NL2SQL,
|
||||
OCR: b.infra.OCR,
|
||||
CacheCli: b.infra.CacheCli,
|
||||
ModelFactory: chatmodel.NewDefaultFactory(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -281,19 +287,19 @@ func (b *basicServices) toMemoryServiceComponents() *memory.ServiceComponents {
|
||||
|
||||
func (b *basicServices) toWorkflowServiceComponents(pluginSVC *plugin.PluginApplicationService, memorySVC *memory.MemoryApplicationServices, knowledgeSVC *knowledge.KnowledgeApplicationService) *workflow.ServiceComponents {
|
||||
return &workflow.ServiceComponents{
|
||||
IDGen: b.infra.IDGenSVC,
|
||||
DB: b.infra.DB,
|
||||
Cache: b.infra.CacheCli,
|
||||
Tos: b.infra.TOSClient,
|
||||
ImageX: b.infra.ImageXClient,
|
||||
DatabaseDomainSVC: memorySVC.DatabaseDomainSVC,
|
||||
VariablesDomainSVC: memorySVC.VariablesDomainSVC,
|
||||
PluginDomainSVC: pluginSVC.DomainSVC,
|
||||
KnowledgeDomainSVC: knowledgeSVC.DomainSVC,
|
||||
ModelManager: b.infra.ModelMgr,
|
||||
DomainNotifier: b.eventbus.resourceEventBus,
|
||||
CPStore: checkpoint.NewRedisStore(b.infra.CacheCli),
|
||||
CodeRunner: b.infra.CodeRunner,
|
||||
IDGen: b.infra.IDGenSVC,
|
||||
DB: b.infra.DB,
|
||||
Cache: b.infra.CacheCli,
|
||||
Tos: b.infra.TOSClient,
|
||||
ImageX: b.infra.ImageXClient,
|
||||
DatabaseDomainSVC: memorySVC.DatabaseDomainSVC,
|
||||
VariablesDomainSVC: memorySVC.VariablesDomainSVC,
|
||||
PluginDomainSVC: pluginSVC.DomainSVC,
|
||||
KnowledgeDomainSVC: knowledgeSVC.DomainSVC,
|
||||
DomainNotifier: b.eventbus.resourceEventBus,
|
||||
CPStore: checkpoint.NewRedisStore(b.infra.CacheCli),
|
||||
CodeRunner: b.infra.CodeRunner,
|
||||
WorkflowBuildInChatModel: b.infra.WorkflowBuildInChatModel,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -18,45 +18,86 @@ package appinfra
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/ClickHouse/clickhouse-go/v2"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/telemetry"
|
||||
"google.golang.org/genai"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"github.com/cloudwego/eino-ext/components/embedding/gemini"
|
||||
"github.com/cloudwego/eino-ext/components/embedding/ollama"
|
||||
"github.com/cloudwego/eino-ext/components/embedding/openai"
|
||||
"github.com/cloudwego/eino/components/prompt"
|
||||
"github.com/cloudwego/eino/schema"
|
||||
"github.com/milvus-io/milvus/client/v2/milvusclient"
|
||||
"github.com/volcengine/volc-sdk-golang/service/visual"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/cache"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/chatmodel"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/coderunner"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/document/nl2sql"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/document/ocr"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/document/parser"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/document/rerank"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/document/searchstore"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/embedding"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/imagex"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/messages2query"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/modelmgr"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/cache/redis"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/coderunner/direct"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/coderunner/sandbox"
|
||||
builtinNL2SQL "github.com/coze-dev/coze-studio/backend/infra/impl/document/nl2sql/builtin"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/document/ocr/ppocr"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/document/ocr/veocr"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/document/parser/builtin"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/document/parser/ppstructure"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/document/rerank/rrf"
|
||||
vikingReranker "github.com/coze-dev/coze-studio/backend/infra/impl/document/rerank/vikingdb"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/document/searchstore/elasticsearch"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/document/searchstore/milvus"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/document/searchstore/vikingdb"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/embedding/ark"
|
||||
embeddingHttp "github.com/coze-dev/coze-studio/backend/infra/impl/embedding/http"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/embedding/wrap"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/es"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/eventbus"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/idgen"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/imagex/veimagex"
|
||||
builtinM2Q "github.com/coze-dev/coze-studio/backend/infra/impl/messages2query/builtin"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/mysql"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/storage"
|
||||
ck "github.com/coze-dev/coze-studio/backend/infra/impl/telemetry/clickhouse"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/lang/conv"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/lang/ptr"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/logs"
|
||||
"github.com/coze-dev/coze-studio/backend/types/consts"
|
||||
)
|
||||
|
||||
type AppDependencies struct {
|
||||
DB *gorm.DB
|
||||
CacheCli *redis.Client
|
||||
IDGenSVC idgen.IDGenerator
|
||||
ESClient es.Client
|
||||
ImageXClient imagex.ImageX
|
||||
TOSClient storage.Storage
|
||||
ResourceEventProducer eventbus.Producer
|
||||
AppEventProducer eventbus.Producer
|
||||
ModelMgr modelmgr.Manager
|
||||
CodeRunner coderunner.Runner
|
||||
TracerProvider telemetry.TracerProvider
|
||||
QueryClient telemetry.QueryClient
|
||||
DB *gorm.DB
|
||||
CacheCli cache.Cmdable
|
||||
IDGenSVC idgen.IDGenerator
|
||||
ESClient es.Client
|
||||
ImageXClient imagex.ImageX
|
||||
TOSClient storage.Storage
|
||||
ResourceEventProducer eventbus.Producer
|
||||
AppEventProducer eventbus.Producer
|
||||
KnowledgeEventProducer eventbus.Producer
|
||||
ModelMgr modelmgr.Manager
|
||||
CodeRunner coderunner.Runner
|
||||
OCR ocr.OCR
|
||||
ParserManager parser.Manager
|
||||
SearchStoreManagers []searchstore.Manager
|
||||
Reranker rerank.Reranker
|
||||
Rewriter messages2query.MessagesToQuery
|
||||
NL2SQL nl2sql.NL2SQL
|
||||
WorkflowBuildInChatModel chatmodel.BaseChatModel
|
||||
}
|
||||
|
||||
func Init(ctx context.Context) (*AppDependencies, error) {
|
||||
@ -65,60 +106,195 @@ func Init(ctx context.Context) (*AppDependencies, error) {
|
||||
|
||||
deps.DB, err = mysql.New()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("init db failed, err=%w", err)
|
||||
}
|
||||
|
||||
deps.CacheCli = redis.New()
|
||||
|
||||
deps.IDGenSVC, err = idgen.New(deps.CacheCli)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("init id gen svc failed, err=%w", err)
|
||||
}
|
||||
|
||||
deps.ESClient, err = es.New()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("init es client failed, err=%w", err)
|
||||
}
|
||||
|
||||
deps.ImageXClient, err = initImageX(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("init imagex client failed, err=%w", err)
|
||||
}
|
||||
|
||||
deps.TOSClient, err = initTOS(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("init tos client failed, err=%w", err)
|
||||
}
|
||||
|
||||
deps.ResourceEventProducer, err = initResourceEventBusProducer()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("init resource event bus producer failed, err=%w", err)
|
||||
}
|
||||
|
||||
deps.AppEventProducer, err = initAppEventProducer()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("init app event producer failed, err=%w", err)
|
||||
}
|
||||
|
||||
deps.KnowledgeEventProducer, err = initKnowledgeEventBusProducer()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init knowledge event bus producer failed, err=%w", err)
|
||||
}
|
||||
|
||||
deps.Reranker = initReranker()
|
||||
|
||||
deps.Rewriter, err = initRewriter(ctx)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init rewriter failed, err=%w", err)
|
||||
}
|
||||
|
||||
deps.NL2SQL, err = initNL2SQL(ctx)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init nl2sql failed, err=%w", err)
|
||||
}
|
||||
|
||||
deps.ModelMgr, err = initModelMgr()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("init model manager failed, err=%w", err)
|
||||
}
|
||||
|
||||
deps.CodeRunner = initCodeRunner()
|
||||
|
||||
deps.TracerProvider, deps.QueryClient, err = initTelemetry()
|
||||
deps.OCR = initOCR()
|
||||
|
||||
imageAnnotationModel, _, err := getBuiltinChatModel(ctx, "IA_")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("get builtin chat model failed, err=%w", err)
|
||||
}
|
||||
|
||||
var ok bool
|
||||
deps.WorkflowBuildInChatModel, ok, err = getBuiltinChatModel(ctx, "WKR_")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("get workflow builtin chat model failed, err=%w", err)
|
||||
}
|
||||
|
||||
if !ok {
|
||||
logs.CtxWarnf(ctx, "workflow builtin chat model for knowledge recall not configured")
|
||||
}
|
||||
|
||||
deps.ParserManager, err = initParserManager(deps.TOSClient, deps.OCR, imageAnnotationModel)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init parser manager failed, err=%w", err)
|
||||
}
|
||||
|
||||
deps.SearchStoreManagers, err = initSearchStoreManagers(ctx, deps.ESClient)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init search store managers failed, err=%w", err)
|
||||
}
|
||||
|
||||
return deps, nil
|
||||
}
|
||||
|
||||
func initSearchStoreManagers(ctx context.Context, es es.Client) ([]searchstore.Manager, error) {
|
||||
// es full text search
|
||||
esSearchstoreManager := elasticsearch.NewManager(&elasticsearch.ManagerConfig{Client: es})
|
||||
|
||||
// vector search
|
||||
mgr, err := getVectorStore(ctx)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init vector store failed, err=%w", err)
|
||||
}
|
||||
|
||||
return []searchstore.Manager{esSearchstoreManager, mgr}, nil
|
||||
}
|
||||
|
||||
func initReranker() rerank.Reranker {
|
||||
rerankerType := os.Getenv("RERANK_TYPE")
|
||||
switch rerankerType {
|
||||
case "vikingdb":
|
||||
return vikingReranker.NewReranker(getVikingRerankerConfig())
|
||||
case "rrf":
|
||||
return rrf.NewRRFReranker(0)
|
||||
default:
|
||||
return rrf.NewRRFReranker(0)
|
||||
}
|
||||
}
|
||||
func getVikingRerankerConfig() *vikingReranker.Config {
|
||||
return &vikingReranker.Config{
|
||||
AK: os.Getenv("VIKINGDB_RERANK_AK"),
|
||||
SK: os.Getenv("VIKINGDB_RERANK_SK"),
|
||||
Domain: os.Getenv("VIKINGDB_RERANK_HOST"),
|
||||
Region: os.Getenv("VIKINGDB_RERANK_REGION"),
|
||||
Model: os.Getenv("VIKINGDB_RERANK_MODEL"),
|
||||
}
|
||||
}
|
||||
func initRewriter(ctx context.Context) (messages2query.MessagesToQuery, error) {
|
||||
rewriterChatModel, _, err := getBuiltinChatModel(ctx, "M2Q_")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
filePath := filepath.Join(getWorkingDirectory(), "resources/conf/prompt/messages_to_query_template_jinja2.json")
|
||||
rewriterTemplate, err := readJinja2PromptTemplate(filePath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
rewriter, err := builtinM2Q.NewMessagesToQuery(ctx, rewriterChatModel, rewriterTemplate)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return rewriter, nil
|
||||
}
|
||||
|
||||
func getWorkingDirectory() string {
|
||||
root, err := os.Getwd()
|
||||
if err != nil {
|
||||
logs.Warnf("[InitConfig] Failed to get current working directory: %v", err)
|
||||
root = os.Getenv("PWD")
|
||||
}
|
||||
return root
|
||||
}
|
||||
|
||||
func readJinja2PromptTemplate(jsonFilePath string) (prompt.ChatTemplate, error) {
|
||||
b, err := os.ReadFile(jsonFilePath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var m2qMessages []*schema.Message
|
||||
if err = json.Unmarshal(b, &m2qMessages); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tpl := make([]schema.MessagesTemplate, len(m2qMessages))
|
||||
for i := range m2qMessages {
|
||||
tpl[i] = m2qMessages[i]
|
||||
}
|
||||
return prompt.FromMessages(schema.Jinja2, tpl...), nil
|
||||
}
|
||||
|
||||
func initNL2SQL(ctx context.Context) (nl2sql.NL2SQL, error) {
|
||||
n2sChatModel, _, err := getBuiltinChatModel(ctx, "NL2SQL_")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
filePath := filepath.Join(getWorkingDirectory(), "resources/conf/prompt/nl2sql_template_jinja2.json")
|
||||
n2sTemplate, err := readJinja2PromptTemplate(filePath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
n2s, err := builtinNL2SQL.NewNL2SQL(ctx, n2sChatModel, n2sTemplate)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return n2s, nil
|
||||
}
|
||||
|
||||
func initImageX(ctx context.Context) (imagex.ImageX, error) {
|
||||
|
||||
uploadComponentType := os.Getenv(consts.FileUploadComponentType)
|
||||
|
||||
if uploadComponentType != consts.FileUploadComponentTypeImagex {
|
||||
return storage.NewImagex(ctx)
|
||||
}
|
||||
@ -157,6 +333,17 @@ func initAppEventProducer() (eventbus.Producer, error) {
|
||||
return appEventProducer, nil
|
||||
}
|
||||
|
||||
func initKnowledgeEventBusProducer() (eventbus.Producer, error) {
|
||||
nameServer := os.Getenv(consts.MQServer)
|
||||
|
||||
knowledgeProducer, err := eventbus.NewProducer(nameServer, consts.RMQTopicKnowledge, consts.RMQConsumeGroupKnowledge, 2)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init knowledge producer failed, err=%w", err)
|
||||
}
|
||||
|
||||
return knowledgeProducer, nil
|
||||
}
|
||||
|
||||
func initCodeRunner() coderunner.Runner {
|
||||
switch typ := os.Getenv(consts.CodeRunnerType); typ {
|
||||
case "sandbox":
|
||||
@ -194,71 +381,336 @@ func initCodeRunner() coderunner.Runner {
|
||||
}
|
||||
}
|
||||
|
||||
func initTelemetry() (telemetry.TracerProvider, telemetry.QueryClient, error) {
|
||||
typ := os.Getenv(consts.TelemetryType)
|
||||
switch typ {
|
||||
case "clickhouse":
|
||||
opts := &clickhouse.Options{
|
||||
Addr: strings.Split(os.Getenv(consts.ClickhouseAddr), ";"),
|
||||
Auth: clickhouse.Auth{
|
||||
Database: getEnvOrDefault(os.Getenv(consts.ClickhouseDBName), "default"),
|
||||
Username: getEnvOrDefault(os.Getenv(consts.ClickhouseUserName), "default"),
|
||||
Password: getEnvOrDefault(os.Getenv(consts.ClickhousePassword), "clickhouse123"),
|
||||
},
|
||||
// Debug: true,
|
||||
// Debugf: func(format string, v ...any) {
|
||||
// fmt.Printf(format+"\n", v...)
|
||||
// },
|
||||
Settings: clickhouse.Settings{
|
||||
"max_execution_time": 60,
|
||||
},
|
||||
Compression: &clickhouse.Compression{
|
||||
Method: clickhouse.CompressionZSTD,
|
||||
Level: 1,
|
||||
},
|
||||
DialTimeout: time.Second * 30,
|
||||
MaxOpenConns: 5,
|
||||
MaxIdleConns: 5,
|
||||
ConnMaxLifetime: time.Duration(10) * time.Minute,
|
||||
ConnOpenStrategy: clickhouse.ConnOpenInOrder,
|
||||
BlockBufferSize: 10,
|
||||
MaxCompressionBuffer: 10240,
|
||||
func initOCR() ocr.OCR {
|
||||
var ocr ocr.OCR
|
||||
switch os.Getenv(consts.OCRType) {
|
||||
case "ve":
|
||||
ocrAK := os.Getenv(consts.VeOCRAK)
|
||||
ocrSK := os.Getenv(consts.VeOCRSK)
|
||||
if ocrAK == "" || ocrSK == "" {
|
||||
logs.Warnf("[ve_ocr] ak / sk not configured, ocr might not work well")
|
||||
}
|
||||
inst := visual.NewInstance()
|
||||
inst.Client.SetAccessKey(ocrAK)
|
||||
inst.Client.SetSecretKey(ocrSK)
|
||||
ocr = veocr.NewOCR(&veocr.Config{Client: inst})
|
||||
case "paddleocr":
|
||||
url := os.Getenv(consts.PPOCRAPIURL)
|
||||
client := &http.Client{}
|
||||
ocr = ppocr.NewOCR(&ppocr.Config{Client: client, URL: url})
|
||||
default:
|
||||
// accept ocr not configured
|
||||
}
|
||||
|
||||
return ocr
|
||||
}
|
||||
|
||||
func initParserManager(storage storage.Storage, ocr ocr.OCR, imageAnnotationModel chatmodel.BaseChatModel) (parser.Manager, error) {
|
||||
var parserManager parser.Manager
|
||||
parserType := os.Getenv(consts.ParserType)
|
||||
switch parserType {
|
||||
case "builtin", "":
|
||||
parserManager = builtin.NewManager(storage, ocr, imageAnnotationModel)
|
||||
case "paddleocr":
|
||||
url := os.Getenv(consts.PPStructureAPIURL)
|
||||
client := &http.Client{}
|
||||
apiConfig := &ppstructure.APIConfig{
|
||||
Client: client,
|
||||
URL: url,
|
||||
}
|
||||
parserManager = ppstructure.NewManager(apiConfig, ocr, storage, imageAnnotationModel)
|
||||
default:
|
||||
return nil, fmt.Errorf("parser type %s not supported", parserType)
|
||||
}
|
||||
|
||||
return parserManager, nil
|
||||
}
|
||||
|
||||
func getVectorStore(ctx context.Context) (searchstore.Manager, error) {
|
||||
vsType := os.Getenv("VECTOR_STORE_TYPE")
|
||||
|
||||
switch vsType {
|
||||
case "milvus":
|
||||
ctx, cancel := context.WithTimeout(ctx, time.Second*5)
|
||||
defer cancel()
|
||||
|
||||
milvusAddr := os.Getenv("MILVUS_ADDR")
|
||||
user := os.Getenv("MILVUS_USER")
|
||||
password := os.Getenv("MILVUS_PASSWORD")
|
||||
mc, err := milvusclient.New(ctx, &milvusclient.ClientConfig{
|
||||
Address: milvusAddr,
|
||||
Username: user,
|
||||
Password: password,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init milvus client failed, err=%w", err)
|
||||
}
|
||||
|
||||
indexRootOnly := os.Getenv(consts.TelemetryIndexRootOnly) == "true"
|
||||
tracerConfig := &ck.TracerConfig{
|
||||
ClickhouseOptions: opts,
|
||||
TracerProviderOptions: nil,
|
||||
IndexRootOnly: indexRootOnly,
|
||||
}
|
||||
tp, err := ck.NewTracerProvider(tracerConfig)
|
||||
emb, err := getEmbedding(ctx)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
var emptySpanID *string
|
||||
if v := os.Getenv(consts.ClickhouseEmptySpanID); v != "" {
|
||||
emptySpanID = &v
|
||||
}
|
||||
queryClientConfig := &ck.QueryClientConfig{
|
||||
ClickhouseOptions: opts,
|
||||
EmptySpanID: emptySpanID,
|
||||
}
|
||||
qc, err := ck.NewQueryClient(queryClientConfig)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return nil, fmt.Errorf("init milvus embedding failed, err=%w", err)
|
||||
}
|
||||
|
||||
return tp, qc, nil
|
||||
mgr, err := milvus.NewManager(&milvus.ManagerConfig{
|
||||
Client: mc,
|
||||
Embedding: emb,
|
||||
EnableHybrid: ptr.Of(true),
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init milvus vector store failed, err=%w", err)
|
||||
}
|
||||
|
||||
return mgr, nil
|
||||
case "vikingdb":
|
||||
var (
|
||||
host = os.Getenv("VIKING_DB_HOST")
|
||||
region = os.Getenv("VIKING_DB_REGION")
|
||||
ak = os.Getenv("VIKING_DB_AK")
|
||||
sk = os.Getenv("VIKING_DB_SK")
|
||||
scheme = os.Getenv("VIKING_DB_SCHEME")
|
||||
modelName = os.Getenv("VIKING_DB_MODEL_NAME")
|
||||
)
|
||||
if ak == "" || sk == "" {
|
||||
return nil, fmt.Errorf("invalid vikingdb ak / sk")
|
||||
}
|
||||
if host == "" {
|
||||
host = "api-vikingdb.volces.com"
|
||||
}
|
||||
if region == "" {
|
||||
region = "cn-beijing"
|
||||
}
|
||||
if scheme == "" {
|
||||
scheme = "https"
|
||||
}
|
||||
|
||||
var embConfig *vikingdb.VikingEmbeddingConfig
|
||||
if modelName != "" {
|
||||
embName := vikingdb.VikingEmbeddingModelName(modelName)
|
||||
if embName.Dimensions() == 0 {
|
||||
return nil, fmt.Errorf("embedding model not support, model_name=%s", modelName)
|
||||
}
|
||||
embConfig = &vikingdb.VikingEmbeddingConfig{
|
||||
UseVikingEmbedding: true,
|
||||
EnableHybrid: embName.SupportStatus() == embedding.SupportDenseAndSparse,
|
||||
ModelName: embName,
|
||||
ModelVersion: embName.ModelVersion(),
|
||||
DenseWeight: ptr.Of(0.2),
|
||||
BuiltinEmbedding: nil,
|
||||
}
|
||||
} else {
|
||||
builtinEmbedding, err := getEmbedding(ctx)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("builtint embedding init failed, err=%w", err)
|
||||
}
|
||||
|
||||
embConfig = &vikingdb.VikingEmbeddingConfig{
|
||||
UseVikingEmbedding: false,
|
||||
EnableHybrid: false,
|
||||
BuiltinEmbedding: builtinEmbedding,
|
||||
}
|
||||
}
|
||||
|
||||
svc := vikingdb.NewVikingDBService(host, region, ak, sk, scheme)
|
||||
mgr, err := vikingdb.NewManager(&vikingdb.ManagerConfig{
|
||||
Service: svc,
|
||||
IndexingConfig: nil, // use default config
|
||||
EmbeddingConfig: embConfig,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init vikingdb manager failed, err=%w", err)
|
||||
}
|
||||
|
||||
return mgr, nil
|
||||
|
||||
default:
|
||||
// TODO: not return errors to achieve compatible upgrades ?
|
||||
return nil, nil, fmt.Errorf("unknown telemetry type: %s", typ)
|
||||
return nil, fmt.Errorf("unexpected vector store type, type=%s", vsType)
|
||||
}
|
||||
}
|
||||
|
||||
func getEnvOrDefault(key, defaultValue string) string {
|
||||
if v := os.Getenv(key); v != "" {
|
||||
return v
|
||||
func getEmbedding(ctx context.Context) (embedding.Embedder, error) {
|
||||
var batchSize int
|
||||
if bs, err := strconv.ParseInt(os.Getenv("EMBEDDING_MAX_BATCH_SIZE"), 10, 64); err != nil {
|
||||
logs.CtxWarnf(ctx, "EMBEDDING_MAX_BATCH_SIZE not set / invalid, using default batchSize=100")
|
||||
batchSize = 100
|
||||
} else {
|
||||
batchSize = int(bs)
|
||||
}
|
||||
return defaultValue
|
||||
|
||||
var emb embedding.Embedder
|
||||
|
||||
switch os.Getenv("EMBEDDING_TYPE") {
|
||||
case "openai":
|
||||
var (
|
||||
openAIEmbeddingBaseURL = os.Getenv("OPENAI_EMBEDDING_BASE_URL")
|
||||
openAIEmbeddingModel = os.Getenv("OPENAI_EMBEDDING_MODEL")
|
||||
openAIEmbeddingApiKey = os.Getenv("OPENAI_EMBEDDING_API_KEY")
|
||||
openAIEmbeddingByAzure = os.Getenv("OPENAI_EMBEDDING_BY_AZURE")
|
||||
openAIEmbeddingApiVersion = os.Getenv("OPENAI_EMBEDDING_API_VERSION")
|
||||
openAIEmbeddingDims = os.Getenv("OPENAI_EMBEDDING_DIMS")
|
||||
openAIRequestEmbeddingDims = os.Getenv("OPENAI_EMBEDDING_REQUEST_DIMS")
|
||||
)
|
||||
|
||||
byAzure, err := strconv.ParseBool(openAIEmbeddingByAzure)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init openai embedding by_azure failed, err=%w", err)
|
||||
}
|
||||
|
||||
dims, err := strconv.ParseInt(openAIEmbeddingDims, 10, 64)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init openai embedding dims failed, err=%w", err)
|
||||
}
|
||||
|
||||
openAICfg := &openai.EmbeddingConfig{
|
||||
APIKey: openAIEmbeddingApiKey,
|
||||
ByAzure: byAzure,
|
||||
BaseURL: openAIEmbeddingBaseURL,
|
||||
APIVersion: openAIEmbeddingApiVersion,
|
||||
Model: openAIEmbeddingModel,
|
||||
// Dimensions: ptr.Of(int(dims)),
|
||||
}
|
||||
reqDims := conv.StrToInt64D(openAIRequestEmbeddingDims, 0)
|
||||
if reqDims > 0 {
|
||||
// some openai model not support request dims
|
||||
openAICfg.Dimensions = ptr.Of(int(reqDims))
|
||||
}
|
||||
|
||||
emb, err = wrap.NewOpenAIEmbedder(ctx, openAICfg, dims, batchSize)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init openai embedding failed, err=%w", err)
|
||||
}
|
||||
|
||||
case "ark":
|
||||
var (
|
||||
arkEmbeddingBaseURL = os.Getenv("ARK_EMBEDDING_BASE_URL")
|
||||
arkEmbeddingModel = os.Getenv("ARK_EMBEDDING_MODEL")
|
||||
arkEmbeddingApiKey = os.Getenv("ARK_EMBEDDING_API_KEY")
|
||||
// deprecated: use ARK_EMBEDDING_API_KEY instead
|
||||
// ARK_EMBEDDING_AK will be removed in the future
|
||||
arkEmbeddingAK = os.Getenv("ARK_EMBEDDING_AK")
|
||||
arkEmbeddingDims = os.Getenv("ARK_EMBEDDING_DIMS")
|
||||
arkEmbeddingAPIType = os.Getenv("ARK_EMBEDDING_API_TYPE")
|
||||
)
|
||||
|
||||
dims, err := strconv.ParseInt(arkEmbeddingDims, 10, 64)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init ark embedding dims failed, err=%w", err)
|
||||
}
|
||||
|
||||
apiType := ark.APITypeText
|
||||
if arkEmbeddingAPIType != "" {
|
||||
if t := ark.APIType(arkEmbeddingAPIType); t != ark.APITypeText && t != ark.APITypeMultiModal {
|
||||
return nil, fmt.Errorf("init ark embedding api_type failed, invalid api_type=%s", t)
|
||||
} else {
|
||||
apiType = t
|
||||
}
|
||||
}
|
||||
|
||||
emb, err = ark.NewArkEmbedder(ctx, &ark.EmbeddingConfig{
|
||||
APIKey: func() string {
|
||||
if arkEmbeddingApiKey != "" {
|
||||
return arkEmbeddingApiKey
|
||||
}
|
||||
return arkEmbeddingAK
|
||||
}(),
|
||||
Model: arkEmbeddingModel,
|
||||
BaseURL: arkEmbeddingBaseURL,
|
||||
APIType: &apiType,
|
||||
}, dims, batchSize)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init ark embedding client failed, err=%w", err)
|
||||
}
|
||||
|
||||
case "ollama":
|
||||
var (
|
||||
ollamaEmbeddingBaseURL = os.Getenv("OLLAMA_EMBEDDING_BASE_URL")
|
||||
ollamaEmbeddingModel = os.Getenv("OLLAMA_EMBEDDING_MODEL")
|
||||
ollamaEmbeddingDims = os.Getenv("OLLAMA_EMBEDDING_DIMS")
|
||||
)
|
||||
|
||||
dims, err := strconv.ParseInt(ollamaEmbeddingDims, 10, 64)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init ollama embedding dims failed, err=%w", err)
|
||||
}
|
||||
|
||||
emb, err = wrap.NewOllamaEmbedder(ctx, &ollama.EmbeddingConfig{
|
||||
BaseURL: ollamaEmbeddingBaseURL,
|
||||
Model: ollamaEmbeddingModel,
|
||||
}, dims, batchSize)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init ollama embedding failed, err=%w", err)
|
||||
}
|
||||
case "gemini":
|
||||
var (
|
||||
geminiEmbeddingBaseURL = os.Getenv("GEMINI_EMBEDDING_BASE_URL")
|
||||
geminiEmbeddingModel = os.Getenv("GEMINI_EMBEDDING_MODEL")
|
||||
geminiEmbeddingApiKey = os.Getenv("GEMINI_EMBEDDING_API_KEY")
|
||||
geminiEmbeddingDims = os.Getenv("GEMINI_EMBEDDING_DIMS")
|
||||
geminiEmbeddingBackend = os.Getenv("GEMINI_EMBEDDING_BACKEND") // "1" for BackendGeminiAPI / "2" for BackendVertexAI
|
||||
geminiEmbeddingProject = os.Getenv("GEMINI_EMBEDDING_PROJECT")
|
||||
geminiEmbeddingLocation = os.Getenv("GEMINI_EMBEDDING_LOCATION")
|
||||
)
|
||||
|
||||
if len(geminiEmbeddingModel) == 0 {
|
||||
return nil, fmt.Errorf("GEMINI_EMBEDDING_MODEL environment variable is required")
|
||||
}
|
||||
if len(geminiEmbeddingApiKey) == 0 {
|
||||
return nil, fmt.Errorf("GEMINI_EMBEDDING_API_KEY environment variable is required")
|
||||
}
|
||||
if len(geminiEmbeddingDims) == 0 {
|
||||
return nil, fmt.Errorf("GEMINI_EMBEDDING_DIMS environment variable is required")
|
||||
}
|
||||
if len(geminiEmbeddingBackend) == 0 {
|
||||
return nil, fmt.Errorf("GEMINI_EMBEDDING_BACKEND environment variable is required")
|
||||
}
|
||||
|
||||
dims, convErr := strconv.ParseInt(geminiEmbeddingDims, 10, 64)
|
||||
if convErr != nil {
|
||||
return nil, fmt.Errorf("invalid GEMINI_EMBEDDING_DIMS value: %s, err=%w", geminiEmbeddingDims, convErr)
|
||||
}
|
||||
|
||||
backend, convErr := strconv.ParseInt(geminiEmbeddingBackend, 10, 64)
|
||||
if convErr != nil {
|
||||
return nil, fmt.Errorf("invalid GEMINI_EMBEDDING_BACKEND value: %s, err=%w", geminiEmbeddingBackend, convErr)
|
||||
}
|
||||
|
||||
geminiCli, err := genai.NewClient(ctx, &genai.ClientConfig{
|
||||
APIKey: geminiEmbeddingApiKey,
|
||||
Backend: genai.Backend(backend),
|
||||
Project: geminiEmbeddingProject,
|
||||
Location: geminiEmbeddingLocation,
|
||||
HTTPOptions: genai.HTTPOptions{
|
||||
BaseURL: geminiEmbeddingBaseURL,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init gemini client failed, err=%w", err)
|
||||
}
|
||||
|
||||
emb, err = wrap.NewGeminiEmbedder(ctx, &gemini.EmbeddingConfig{
|
||||
Client: geminiCli,
|
||||
Model: geminiEmbeddingModel,
|
||||
OutputDimensionality: ptr.Of(int32(dims)),
|
||||
}, dims, batchSize)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init gemini embedding failed, err=%w", err)
|
||||
}
|
||||
case "http":
|
||||
var (
|
||||
httpEmbeddingBaseURL = os.Getenv("HTTP_EMBEDDING_ADDR")
|
||||
httpEmbeddingDims = os.Getenv("HTTP_EMBEDDING_DIMS")
|
||||
)
|
||||
dims, err := strconv.ParseInt(httpEmbeddingDims, 10, 64)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init http embedding dims failed, err=%w", err)
|
||||
}
|
||||
emb, err = embeddingHttp.NewEmbedding(httpEmbeddingBaseURL, dims, batchSize)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init http embedding failed, err=%w", err)
|
||||
}
|
||||
|
||||
default:
|
||||
return nil, fmt.Errorf("init knowledge embedding failed, type not configured")
|
||||
}
|
||||
|
||||
return emb, nil
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package internal
|
||||
package appinfra
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -33,7 +33,7 @@ import (
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/chatmodel"
|
||||
)
|
||||
|
||||
func GetBuiltinChatModel(ctx context.Context, envPrefix string) (bcm chatmodel.BaseChatModel, configured bool, err error) {
|
||||
func getBuiltinChatModel(ctx context.Context, envPrefix string) (bcm chatmodel.BaseChatModel, configured bool, err error) {
|
||||
getEnv := func(key string) string {
|
||||
if val := os.Getenv(envPrefix + key); val != "" {
|
||||
return val
|
||||
@ -99,7 +99,7 @@ func GetBuiltinChatModel(ctx context.Context, envPrefix string) (bcm chatmodel.B
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, false, fmt.Errorf("knowledge init openai chat mode failed, %w", err)
|
||||
return nil, false, fmt.Errorf("builtin %s chat model init failed, %w", envPrefix, err)
|
||||
}
|
||||
if bcm != nil {
|
||||
configured = true
|
||||
@ -25,7 +25,7 @@ import (
|
||||
"github.com/coze-dev/coze-studio/backend/domain/plugin/entity"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/crossdomain/plugin"
|
||||
common "github.com/coze-dev/coze-studio/backend/api/model/plugin_develop_common"
|
||||
common "github.com/coze-dev/coze-studio/backend/api/model/plugin_develop/common"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/errorx"
|
||||
"github.com/coze-dev/coze-studio/backend/types/errno"
|
||||
)
|
||||
|
||||
@ -53,6 +53,10 @@ func (m *OpenapiMessageApplication) GetApiMessageList(ctx context.Context, mr *m
|
||||
return nil, errorx.New(errno.ErrConversationPermissionCode, errorx.KV("msg", "permission denied"))
|
||||
}
|
||||
|
||||
if mr.Limit == nil {
|
||||
mr.Limit = ptr.Of(int64(50))
|
||||
}
|
||||
|
||||
msgListMeta := &entity.ListMeta{
|
||||
ConversationID: currentConversation.ID,
|
||||
AgentID: currentConversation.AgentID,
|
||||
|
||||
@ -25,10 +25,10 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
modelCommon "github.com/coze-dev/coze-studio/backend/api/model/common"
|
||||
knowledgeModel "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/knowledge"
|
||||
model "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/knowledge"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/flow/dataengine/dataset"
|
||||
dataset "github.com/coze-dev/coze-studio/backend/api/model/data/knowledge"
|
||||
modelCommon "github.com/coze-dev/coze-studio/backend/api/model/data/knowledge"
|
||||
"github.com/coze-dev/coze-studio/backend/application/upload"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/knowledge/entity"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/knowledge/service"
|
||||
|
||||
@ -18,402 +18,27 @@ package knowledge
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/cloudwego/eino-ext/components/embedding/ark"
|
||||
ollamaEmb "github.com/cloudwego/eino-ext/components/embedding/ollama"
|
||||
"github.com/cloudwego/eino-ext/components/embedding/openai"
|
||||
"github.com/cloudwego/eino/components/prompt"
|
||||
"github.com/cloudwego/eino/schema"
|
||||
"github.com/milvus-io/milvus/client/v2/milvusclient"
|
||||
"github.com/volcengine/volc-sdk-golang/service/vikingdb"
|
||||
"github.com/volcengine/volc-sdk-golang/service/visual"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/application/internal"
|
||||
"github.com/coze-dev/coze-studio/backend/application/search"
|
||||
knowledgeImpl "github.com/coze-dev/coze-studio/backend/domain/knowledge/service"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/cache"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/document/nl2sql"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/document/ocr"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/document/searchstore"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/embedding"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/es"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/idgen"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/imagex"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/messages2query"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/rdb"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/storage"
|
||||
chatmodelImpl "github.com/coze-dev/coze-studio/backend/infra/impl/chatmodel"
|
||||
builtinNL2SQL "github.com/coze-dev/coze-studio/backend/infra/impl/document/nl2sql/builtin"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/document/ocr/veocr"
|
||||
builtinParser "github.com/coze-dev/coze-studio/backend/infra/impl/document/parser/builtin"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/document/rerank/rrf"
|
||||
sses "github.com/coze-dev/coze-studio/backend/infra/impl/document/searchstore/elasticsearch"
|
||||
ssmilvus "github.com/coze-dev/coze-studio/backend/infra/impl/document/searchstore/milvus"
|
||||
ssvikingdb "github.com/coze-dev/coze-studio/backend/infra/impl/document/searchstore/vikingdb"
|
||||
arkemb "github.com/coze-dev/coze-studio/backend/infra/impl/embedding/ark"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/embedding/http"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/embedding/wrap"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/impl/eventbus"
|
||||
builtinM2Q "github.com/coze-dev/coze-studio/backend/infra/impl/messages2query/builtin"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/lang/conv"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/lang/ptr"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/logs"
|
||||
"github.com/coze-dev/coze-studio/backend/types/consts"
|
||||
)
|
||||
|
||||
type ServiceComponents struct {
|
||||
DB *gorm.DB
|
||||
IDGenSVC idgen.IDGenerator
|
||||
Storage storage.Storage
|
||||
RDB rdb.RDB
|
||||
ImageX imagex.ImageX
|
||||
ES es.Client
|
||||
EventBus search.ResourceEventBus
|
||||
CacheCli cache.Cmdable
|
||||
}
|
||||
type ServiceComponents = knowledgeImpl.KnowledgeSVCConfig
|
||||
|
||||
func InitService(c *ServiceComponents) (*KnowledgeApplicationService, error) {
|
||||
ctx := context.Background()
|
||||
func InitService(ctx context.Context, c *ServiceComponents, bus search.ResourceEventBus) (*KnowledgeApplicationService, error) {
|
||||
knowledgeDomainSVC, knowledgeEventHandler := knowledgeImpl.NewKnowledgeSVC(c)
|
||||
|
||||
nameServer := os.Getenv(consts.MQServer)
|
||||
|
||||
knowledgeProducer, err := eventbus.NewProducer(nameServer, consts.RMQTopicKnowledge, consts.RMQConsumeGroupKnowledge, 2)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init knowledge producer failed, err=%w", err)
|
||||
}
|
||||
|
||||
var sManagers []searchstore.Manager
|
||||
|
||||
// es full text search
|
||||
sManagers = append(sManagers, sses.NewManager(&sses.ManagerConfig{Client: c.ES}))
|
||||
|
||||
// vector search
|
||||
mgr, err := getVectorStore(ctx)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init vector store failed, err=%w", err)
|
||||
}
|
||||
sManagers = append(sManagers, mgr)
|
||||
|
||||
var ocrImpl ocr.OCR
|
||||
switch os.Getenv("OCR_TYPE") {
|
||||
case "ve":
|
||||
ocrAK := os.Getenv("VE_OCR_AK")
|
||||
ocrSK := os.Getenv("VE_OCR_SK")
|
||||
if ocrAK == "" || ocrSK == "" {
|
||||
logs.Warnf("[ve_ocr] ak / sk not configured, ocr might not work well")
|
||||
}
|
||||
inst := visual.NewInstance()
|
||||
inst.Client.SetAccessKey(ocrAK)
|
||||
inst.Client.SetSecretKey(ocrSK)
|
||||
ocrImpl = veocr.NewOCR(&veocr.Config{Client: inst})
|
||||
default:
|
||||
// accept ocr not configured
|
||||
}
|
||||
|
||||
root, err := os.Getwd()
|
||||
if err != nil {
|
||||
logs.Warnf("[InitConfig] Failed to get current working directory: %v", err)
|
||||
root = os.Getenv("PWD")
|
||||
}
|
||||
|
||||
var rewriter messages2query.MessagesToQuery
|
||||
if rewriterChatModel, _, err := internal.GetBuiltinChatModel(ctx, "M2Q_"); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
filePath := filepath.Join(root, "resources/conf/prompt/messages_to_query_template_jinja2.json")
|
||||
rewriterTemplate, err := readJinja2PromptTemplate(filePath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rewriter, err = builtinM2Q.NewMessagesToQuery(ctx, rewriterChatModel, rewriterTemplate)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
var n2s nl2sql.NL2SQL
|
||||
if n2sChatModel, _, err := internal.GetBuiltinChatModel(ctx, "NL2SQL_"); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
filePath := filepath.Join(root, "resources/conf/prompt/nl2sql_template_jinja2.json")
|
||||
n2sTemplate, err := readJinja2PromptTemplate(filePath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
n2s, err = builtinNL2SQL.NewNL2SQL(ctx, n2sChatModel, n2sTemplate)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
imageAnnoChatModel, configured, err := internal.GetBuiltinChatModel(ctx, "IA_")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
knowledgeDomainSVC, knowledgeEventHandler := knowledgeImpl.NewKnowledgeSVC(&knowledgeImpl.KnowledgeSVCConfig{
|
||||
DB: c.DB,
|
||||
IDGen: c.IDGenSVC,
|
||||
RDB: c.RDB,
|
||||
Producer: knowledgeProducer,
|
||||
SearchStoreManagers: sManagers,
|
||||
ParseManager: builtinParser.NewManager(c.Storage, ocrImpl, imageAnnoChatModel), // default builtin
|
||||
Storage: c.Storage,
|
||||
Rewriter: rewriter,
|
||||
Reranker: rrf.NewRRFReranker(0), // default rrf
|
||||
NL2Sql: n2s,
|
||||
OCR: ocrImpl,
|
||||
CacheCli: c.CacheCli,
|
||||
IsAutoAnnotationSupported: configured,
|
||||
ModelFactory: chatmodelImpl.NewDefaultFactory(),
|
||||
})
|
||||
|
||||
if err = eventbus.RegisterConsumer(nameServer, consts.RMQTopicKnowledge, consts.RMQConsumeGroupKnowledge, knowledgeEventHandler); err != nil {
|
||||
if err := eventbus.DefaultSVC().RegisterConsumer(nameServer, consts.RMQTopicKnowledge, consts.RMQConsumeGroupKnowledge, knowledgeEventHandler); err != nil {
|
||||
return nil, fmt.Errorf("register knowledge consumer failed, err=%w", err)
|
||||
}
|
||||
|
||||
KnowledgeSVC.DomainSVC = knowledgeDomainSVC
|
||||
KnowledgeSVC.eventBus = c.EventBus
|
||||
KnowledgeSVC.eventBus = bus
|
||||
KnowledgeSVC.storage = c.Storage
|
||||
return KnowledgeSVC, nil
|
||||
}
|
||||
|
||||
func getVectorStore(ctx context.Context) (searchstore.Manager, error) {
|
||||
vsType := os.Getenv("VECTOR_STORE_TYPE")
|
||||
|
||||
switch vsType {
|
||||
case "milvus":
|
||||
cctx, cancel := context.WithTimeout(ctx, time.Second*5)
|
||||
defer cancel()
|
||||
|
||||
milvusAddr := os.Getenv("MILVUS_ADDR")
|
||||
mc, err := milvusclient.New(cctx, &milvusclient.ClientConfig{Address: milvusAddr})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init milvus client failed, err=%w", err)
|
||||
}
|
||||
|
||||
emb, err := getEmbedding(ctx)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init milvus embedding failed, err=%w", err)
|
||||
}
|
||||
|
||||
mgr, err := ssmilvus.NewManager(&ssmilvus.ManagerConfig{
|
||||
Client: mc,
|
||||
Embedding: emb,
|
||||
EnableHybrid: ptr.Of(true),
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init milvus vector store failed, err=%w", err)
|
||||
}
|
||||
|
||||
return mgr, nil
|
||||
case "vikingdb":
|
||||
var (
|
||||
host = os.Getenv("VIKING_DB_HOST")
|
||||
region = os.Getenv("VIKING_DB_REGION")
|
||||
ak = os.Getenv("VIKING_DB_AK")
|
||||
sk = os.Getenv("VIKING_DB_SK")
|
||||
scheme = os.Getenv("VIKING_DB_SCHEME")
|
||||
modelName = os.Getenv("VIKING_DB_MODEL_NAME")
|
||||
)
|
||||
if ak == "" || sk == "" {
|
||||
return nil, fmt.Errorf("invalid vikingdb ak / sk")
|
||||
}
|
||||
if host == "" {
|
||||
host = "api-vikingdb.volces.com"
|
||||
}
|
||||
if region == "" {
|
||||
region = "cn-beijing"
|
||||
}
|
||||
if scheme == "" {
|
||||
scheme = "https"
|
||||
}
|
||||
|
||||
var embConfig *ssvikingdb.VikingEmbeddingConfig
|
||||
if modelName != "" {
|
||||
embName := ssvikingdb.VikingEmbeddingModelName(modelName)
|
||||
if embName.Dimensions() == 0 {
|
||||
return nil, fmt.Errorf("embedding model not support, model_name=%s", modelName)
|
||||
}
|
||||
embConfig = &ssvikingdb.VikingEmbeddingConfig{
|
||||
UseVikingEmbedding: true,
|
||||
EnableHybrid: embName.SupportStatus() == embedding.SupportDenseAndSparse,
|
||||
ModelName: embName,
|
||||
ModelVersion: embName.ModelVersion(),
|
||||
DenseWeight: ptr.Of(0.2),
|
||||
BuiltinEmbedding: nil,
|
||||
}
|
||||
} else {
|
||||
builtinEmbedding, err := getEmbedding(ctx)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("builtint embedding init failed, err=%w", err)
|
||||
}
|
||||
|
||||
embConfig = &ssvikingdb.VikingEmbeddingConfig{
|
||||
UseVikingEmbedding: false,
|
||||
EnableHybrid: false,
|
||||
BuiltinEmbedding: builtinEmbedding,
|
||||
}
|
||||
}
|
||||
svc := vikingdb.NewVikingDBService(host, region, ak, sk, scheme)
|
||||
mgr, err := ssvikingdb.NewManager(&ssvikingdb.ManagerConfig{
|
||||
Service: svc,
|
||||
IndexingConfig: nil, // use default config
|
||||
EmbeddingConfig: embConfig,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init vikingdb manager failed, err=%w", err)
|
||||
}
|
||||
|
||||
return mgr, nil
|
||||
|
||||
default:
|
||||
return nil, fmt.Errorf("unexpected vector store type, type=%s", vsType)
|
||||
}
|
||||
}
|
||||
|
||||
func getEmbedding(ctx context.Context) (embedding.Embedder, error) {
|
||||
var batchSize int
|
||||
if bs, err := strconv.ParseInt(os.Getenv("EMBEDDING_MAX_BATCH_SIZE"), 10, 64); err != nil {
|
||||
logs.CtxWarnf(ctx, "EMBEDDING_MAX_BATCH_SIZE not set / invalid, using default batchSize=100")
|
||||
batchSize = 100
|
||||
} else {
|
||||
batchSize = int(bs)
|
||||
}
|
||||
|
||||
var emb embedding.Embedder
|
||||
|
||||
switch os.Getenv("EMBEDDING_TYPE") {
|
||||
case "openai":
|
||||
var (
|
||||
openAIEmbeddingBaseURL = os.Getenv("OPENAI_EMBEDDING_BASE_URL")
|
||||
openAIEmbeddingModel = os.Getenv("OPENAI_EMBEDDING_MODEL")
|
||||
openAIEmbeddingApiKey = os.Getenv("OPENAI_EMBEDDING_API_KEY")
|
||||
openAIEmbeddingByAzure = os.Getenv("OPENAI_EMBEDDING_BY_AZURE")
|
||||
openAIEmbeddingApiVersion = os.Getenv("OPENAI_EMBEDDING_API_VERSION")
|
||||
openAIEmbeddingDims = os.Getenv("OPENAI_EMBEDDING_DIMS")
|
||||
openAIRequestEmbeddingDims = os.Getenv("OPENAI_EMBEDDING_REQUEST_DIMS")
|
||||
)
|
||||
|
||||
byAzure, err := strconv.ParseBool(openAIEmbeddingByAzure)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init openai embedding by_azure failed, err=%w", err)
|
||||
}
|
||||
|
||||
dims, err := strconv.ParseInt(openAIEmbeddingDims, 10, 64)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init openai embedding dims failed, err=%w", err)
|
||||
}
|
||||
|
||||
openAICfg := &openai.EmbeddingConfig{
|
||||
APIKey: openAIEmbeddingApiKey,
|
||||
ByAzure: byAzure,
|
||||
BaseURL: openAIEmbeddingBaseURL,
|
||||
APIVersion: openAIEmbeddingApiVersion,
|
||||
Model: openAIEmbeddingModel,
|
||||
// Dimensions: ptr.Of(int(dims)),
|
||||
}
|
||||
reqDims := conv.StrToInt64D(openAIRequestEmbeddingDims, 0)
|
||||
if reqDims > 0 {
|
||||
// some openai model not support request dims
|
||||
openAICfg.Dimensions = ptr.Of(int(reqDims))
|
||||
}
|
||||
|
||||
emb, err = wrap.NewOpenAIEmbedder(ctx, openAICfg, dims, batchSize)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init openai embedding failed, err=%w", err)
|
||||
}
|
||||
|
||||
case "ark":
|
||||
var (
|
||||
arkEmbeddingBaseURL = os.Getenv("ARK_EMBEDDING_BASE_URL")
|
||||
arkEmbeddingModel = os.Getenv("ARK_EMBEDDING_MODEL")
|
||||
arkEmbeddingApiKey = os.Getenv("ARK_EMBEDDING_API_KEY")
|
||||
// deprecated: use ARK_EMBEDDING_API_KEY instead
|
||||
// ARK_EMBEDDING_AK will be removed in the future
|
||||
arkEmbeddingAK = os.Getenv("ARK_EMBEDDING_AK")
|
||||
arkEmbeddingDims = os.Getenv("ARK_EMBEDDING_DIMS")
|
||||
)
|
||||
|
||||
dims, err := strconv.ParseInt(arkEmbeddingDims, 10, 64)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init ark embedding dims failed, err=%w", err)
|
||||
}
|
||||
|
||||
emb, err = arkemb.NewArkEmbedder(ctx, &ark.EmbeddingConfig{
|
||||
APIKey: func() string {
|
||||
if arkEmbeddingApiKey != "" {
|
||||
return arkEmbeddingApiKey
|
||||
}
|
||||
return arkEmbeddingAK
|
||||
}(),
|
||||
Model: arkEmbeddingModel,
|
||||
BaseURL: arkEmbeddingBaseURL,
|
||||
}, dims, batchSize)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init ark embedding client failed, err=%w", err)
|
||||
}
|
||||
|
||||
case "ollama":
|
||||
var (
|
||||
ollamaEmbeddingBaseURL = os.Getenv("OLLAMA_EMBEDDING_BASE_URL")
|
||||
ollamaEmbeddingModel = os.Getenv("OLLAMA_EMBEDDING_MODEL")
|
||||
ollamaEmbeddingDims = os.Getenv("OLLAMA_EMBEDDING_DIMS")
|
||||
)
|
||||
|
||||
dims, err := strconv.ParseInt(ollamaEmbeddingDims, 10, 64)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init ollama embedding dims failed, err=%w", err)
|
||||
}
|
||||
|
||||
emb, err = wrap.NewOllamaEmbedder(ctx, &ollamaEmb.EmbeddingConfig{
|
||||
BaseURL: ollamaEmbeddingBaseURL,
|
||||
Model: ollamaEmbeddingModel,
|
||||
}, dims, batchSize)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init ollama embedding failed, err=%w", err)
|
||||
}
|
||||
|
||||
case "http":
|
||||
var (
|
||||
httpEmbeddingBaseURL = os.Getenv("HTTP_EMBEDDING_ADDR")
|
||||
httpEmbeddingDims = os.Getenv("HTTP_EMBEDDING_DIMS")
|
||||
)
|
||||
dims, err := strconv.ParseInt(httpEmbeddingDims, 10, 64)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init http embedding dims failed, err=%w", err)
|
||||
}
|
||||
emb, err = http.NewEmbedding(httpEmbeddingBaseURL, dims, batchSize)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("init http embedding failed, err=%w", err)
|
||||
}
|
||||
|
||||
default:
|
||||
return nil, fmt.Errorf("init knowledge embedding failed, type not configured")
|
||||
}
|
||||
|
||||
return emb, nil
|
||||
}
|
||||
|
||||
func readJinja2PromptTemplate(jsonFilePath string) (prompt.ChatTemplate, error) {
|
||||
b, err := os.ReadFile(jsonFilePath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var m2qMessages []*schema.Message
|
||||
if err = json.Unmarshal(b, &m2qMessages); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tpl := make([]schema.MessagesTemplate, len(m2qMessages))
|
||||
for i := range m2qMessages {
|
||||
tpl[i] = m2qMessages[i]
|
||||
}
|
||||
return prompt.FromMessages(schema.Jinja2, tpl...), nil
|
||||
}
|
||||
|
||||
@ -26,10 +26,10 @@ import (
|
||||
|
||||
"github.com/bytedance/sonic"
|
||||
|
||||
modelCommon "github.com/coze-dev/coze-studio/backend/api/model/common"
|
||||
model "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/knowledge"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/flow/dataengine/dataset"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/knowledge/document"
|
||||
dataset "github.com/coze-dev/coze-studio/backend/api/model/data/knowledge"
|
||||
document "github.com/coze-dev/coze-studio/backend/api/model/data/knowledge"
|
||||
modelCommon "github.com/coze-dev/coze-studio/backend/api/model/data/knowledge"
|
||||
resource "github.com/coze-dev/coze-studio/backend/api/model/resource/common"
|
||||
"github.com/coze-dev/coze-studio/backend/application/base/ctxutil"
|
||||
"github.com/coze-dev/coze-studio/backend/application/search"
|
||||
|
||||
@ -23,7 +23,7 @@ import (
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/base"
|
||||
model "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/database"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/table"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/data/database/table"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/memory/database/entity"
|
||||
database "github.com/coze-dev/coze-studio/backend/domain/memory/database/service"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/lang/ptr"
|
||||
|
||||
@ -22,12 +22,13 @@ import (
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/base"
|
||||
model "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/database"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/knowledge/document"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/data/database/table"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/data/knowledge"
|
||||
document "github.com/coze-dev/coze-studio/backend/api/model/data/knowledge"
|
||||
resCommon "github.com/coze-dev/coze-studio/backend/api/model/resource/common"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/table"
|
||||
"github.com/coze-dev/coze-studio/backend/application/base/ctxutil"
|
||||
"github.com/coze-dev/coze-studio/backend/application/search"
|
||||
"github.com/coze-dev/coze-studio/backend/crossdomain/contract/crossuser"
|
||||
crossuser "github.com/coze-dev/coze-studio/backend/crossdomain/contract/user"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/memory/database/entity"
|
||||
databaseEntity "github.com/coze-dev/coze-studio/backend/domain/memory/database/entity"
|
||||
database "github.com/coze-dev/coze-studio/backend/domain/memory/database/service"
|
||||
@ -48,8 +49,8 @@ type DatabaseApplicationService struct {
|
||||
|
||||
var DatabaseApplicationSVC = DatabaseApplicationService{}
|
||||
|
||||
func (d *DatabaseApplicationService) GetModeConfig(ctx context.Context, req *table.GetModeConfigRequest) (*table.GetModeConfigResponse, error) {
|
||||
return &table.GetModeConfigResponse{
|
||||
func (d *DatabaseApplicationService) GetModeConfig(ctx context.Context, req *knowledge.GetModeConfigRequest) (*knowledge.GetModeConfigResponse, error) {
|
||||
return &knowledge.GetModeConfigResponse{
|
||||
Code: 0,
|
||||
Msg: "success",
|
||||
BotID: req.BotID,
|
||||
|
||||
@ -19,12 +19,11 @@ package memory
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
|
||||
"github.com/redis/go-redis/v9"
|
||||
|
||||
database "github.com/coze-dev/coze-studio/backend/domain/memory/database/service"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/memory/variables/repository"
|
||||
variables "github.com/coze-dev/coze-studio/backend/domain/memory/variables/service"
|
||||
search "github.com/coze-dev/coze-studio/backend/domain/search/service"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/cache"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/idgen"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/rdb"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/storage"
|
||||
@ -43,7 +42,7 @@ type ServiceComponents struct {
|
||||
EventBus search.ResourceEventBus
|
||||
TosClient storage.Storage
|
||||
ResourceDomainNotifier search.ResourceEventBus
|
||||
CacheCli *redis.Client
|
||||
CacheCli cache.Cmdable
|
||||
}
|
||||
|
||||
func InitService(c *ServiceComponents) *MemoryApplicationServices {
|
||||
|
||||
@ -24,8 +24,8 @@ import (
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/base"
|
||||
model "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/variables"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/kvmemory"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/project_memory"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/data/variable/kvmemory"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/data/variable/project_memory"
|
||||
"github.com/coze-dev/coze-studio/backend/application/base/ctxutil"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/memory/variables/entity"
|
||||
variables "github.com/coze-dev/coze-studio/backend/domain/memory/variables/service"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user