Skip to content

Commit

Permalink
bump version to 0.5.3 (#2306)
Browse files Browse the repository at this point in the history
  • Loading branch information
takatost authored Feb 1, 2024
1 parent b521aaf commit 9f637ea
Show file tree
Hide file tree
Showing 169 changed files with 547 additions and 626 deletions.
2 changes: 1 addition & 1 deletion api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from flask_cors import CORS
from libs.passport import PassportService
# DO NOT REMOVE BELOW
from models import account, dataset, model, source, task, tool, web, tools
from models import account, dataset, model, source, task, tool, tools, web
from services.account_service import AccountService

# DO NOT REMOVE ABOVE
Expand Down
2 changes: 1 addition & 1 deletion api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def __init__(self):
# ------------------------
# General Configurations.
# ------------------------
self.CURRENT_VERSION = "0.5.2"
self.CURRENT_VERSION = "0.5.3"
self.COMMIT_SHA = get_env('COMMIT_SHA')
self.EDITION = "SELF_HOSTED"
self.DEPLOY_ENV = get_env('DEPLOY_ENV')
Expand Down
1 change: 1 addition & 0 deletions api/constants/languages.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

import json

from models.model import AppModelConfig

languages = ['en-US', 'zh-Hans', 'pt-BR', 'es-ES', 'fr-FR', 'de-DE', 'ja-JP', 'ko-KR', 'ru-RU', 'it-IT']
Expand Down
4 changes: 2 additions & 2 deletions api/controllers/console/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
model_config, site, statistic)
# Import auth controllers
from .auth import activate, data_source_oauth, login, oauth
# Import billing controllers
from .billing import billing
# Import datasets controllers
from .datasets import data_source, datasets, datasets_document, datasets_segments, file, hit_testing
# Import explore controllers
from .explore import audio, completion, conversation, installed_app, message, parameter, recommended_app, saved_message
# Import workspace controllers
from .workspace import account, members, model_providers, models, tool_providers, workspace
# Import billing controllers
from .billing import billing
2 changes: 1 addition & 1 deletion api/controllers/console/admin.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import os
from functools import wraps

from constants.languages import supported_language
from controllers.console import api
from controllers.console.wraps import only_edition_cloud
from extensions.ext_database import db
from flask import request
from flask_restful import Resource, reqparse
from constants.languages import supported_language
from models.model import App, InstalledApp, RecommendedApp
from werkzeug.exceptions import NotFound, Unauthorized

Expand Down
3 changes: 2 additions & 1 deletion api/controllers/console/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import logging
from datetime import datetime

from constants.model_template import model_templates
from constants.languages import demo_model_templates, languages
from constants.model_template import model_templates
from controllers.console import api
from controllers.console.app.error import AppNotFoundError, ProviderNotInitializeError
from controllers.console.setup import setup_required
Expand All @@ -26,6 +26,7 @@
from services.app_model_config_service import AppModelConfigService
from werkzeug.exceptions import Forbidden


def _get_app(app_id, tenant_id):
app = db.session.query(App).filter(App.id == app_id, App.tenant_id == tenant_id).first()
if not app:
Expand Down
2 changes: 1 addition & 1 deletion api/controllers/console/app/site.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding:utf-8 -*-
from constants.languages import supported_language
from controllers.console import api
from controllers.console.app import _get_app
from controllers.console.setup import setup_required
Expand All @@ -7,7 +8,6 @@
from fields.app_fields import app_site_fields
from flask_login import current_user
from flask_restful import Resource, marshal_with, reqparse
from constants.languages import supported_language
from libs.login import login_required
from models.model import Site
from werkzeug.exceptions import Forbidden, NotFound
Expand Down
2 changes: 1 addition & 1 deletion api/controllers/console/auth/activate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import secrets
from datetime import datetime

from constants.languages import supported_language
from controllers.console import api
from controllers.console.error import AlreadyActivateError
from extensions.ext_database import db
from flask_restful import Resource, reqparse
from libs.helper import email, str_len, timezone
from constants.languages import supported_language
from libs.password import hash_password, valid_password
from models.account import AccountStatus, Tenant
from services.account_service import RegisterService
Expand Down
2 changes: 1 addition & 1 deletion api/controllers/console/datasets/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from flask_login import current_user
from flask_restful import Resource, marshal_with
from libs.login import login_required
from services.file_service import FileService, ALLOWED_EXTENSIONS, UNSTRUSTURED_ALLOWED_EXTENSIONS
from services.file_service import ALLOWED_EXTENSIONS, UNSTRUSTURED_ALLOWED_EXTENSIONS, FileService

PREVIEW_WORDS_LIMIT = 3000

Expand Down
4 changes: 2 additions & 2 deletions api/controllers/console/explore/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
from fields.message_fields import message_infinite_scroll_pagination_fields
from flask import Response, stream_with_context
from flask_login import current_user
from flask_restful import marshal_with, reqparse, fields
from flask_restful import fields, marshal_with, reqparse
from flask_restful.inputs import int_range
from libs.helper import uuid_value, TimestampField
from libs.helper import TimestampField, uuid_value
from services.completion_service import CompletionService
from services.errors.app import MoreLikeThisDisabledError
from services.errors.conversation import ConversationNotExistsError
Expand Down
4 changes: 2 additions & 2 deletions api/controllers/console/explore/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

from controllers.console import api
from controllers.console.explore.wraps import InstalledAppResource
from extensions.ext_database import db
from flask import current_app
from flask_restful import fields, marshal_with
from models.model import InstalledApp, AppModelConfig
from models.model import AppModelConfig, InstalledApp
from models.tools import ApiToolProvider

from extensions.ext_database import db

class AppParameterApi(InstalledAppResource):
"""Resource for app variables."""
Expand Down
2 changes: 1 addition & 1 deletion api/controllers/console/explore/recommended_app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding:utf-8 -*-
from constants.languages import languages
from controllers.console import api
from controllers.console.app.error import AppNotFoundError
from controllers.console.wraps import account_initialization_required
Expand All @@ -9,7 +10,6 @@
from models.model import App, InstalledApp, RecommendedApp
from services.account_service import TenantService
from sqlalchemy import and_
from constants.languages import languages

app_fields = {
'id': fields.String,
Expand Down
1 change: 1 addition & 0 deletions api/controllers/console/init_validate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os

from flask import current_app, session
from flask_restful import Resource, reqparse
from libs.helper import str_len
Expand Down
2 changes: 1 addition & 1 deletion api/controllers/console/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from services.account_service import AccountService, RegisterService, TenantService

from . import api
from .error import AlreadySetupError, NotSetupError, NotInitValidateError
from .error import AlreadySetupError, NotInitValidateError, NotSetupError
from .init_validate import get_init_validate_status
from .wraps import only_edition_self_hosted

Expand Down
2 changes: 1 addition & 1 deletion api/controllers/console/workspace/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from datetime import datetime

import pytz
from constants.languages import supported_language
from controllers.console import api
from controllers.console.setup import setup_required
from controllers.console.workspace.error import (AccountAlreadyInitedError, CurrentPasswordIncorrectError,
Expand All @@ -12,7 +13,6 @@
from flask_login import current_user
from flask_restful import Resource, fields, marshal_with, reqparse
from libs.helper import TimestampField, timezone
from constants.languages import supported_language
from libs.login import login_required
from models.account import AccountIntegrate, InvitationCode
from services.account_service import AccountService
Expand Down
7 changes: 3 additions & 4 deletions api/controllers/console/workspace/members.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# -*- coding:utf-8 -*-
from flask import current_app
from flask_login import current_user
from flask_restful import Resource, abort, fields, marshal_with, reqparse

import services
from controllers.console import api
from controllers.console.setup import setup_required
from controllers.console.wraps import account_initialization_required, cloud_edition_billing_resource_check
from extensions.ext_database import db
from flask import current_app
from flask_login import current_user
from flask_restful import Resource, abort, fields, marshal_with, reqparse
from libs.helper import TimestampField
from libs.login import login_required
from models.account import Account
Expand Down
14 changes: 6 additions & 8 deletions api/controllers/console/workspace/tool_providers.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import io
import json

from libs.login import login_required
from flask_login import current_user
from flask_restful import Resource, reqparse
from flask import send_file
from werkzeug.exceptions import Forbidden

from controllers.console import api
from controllers.console.setup import setup_required
from controllers.console.wraps import account_initialization_required

from flask import send_file
from flask_login import current_user
from flask_restful import Resource, reqparse
from libs.login import login_required
from services.tools_manage_service import ToolManageService
from werkzeug.exceptions import Forbidden

import io

class ToolProviderListApi(Resource):
@setup_required
Expand Down
3 changes: 1 addition & 2 deletions api/controllers/console/wraps.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# -*- coding:utf-8 -*-
import json
from functools import wraps
from flask import request

from controllers.console.workspace.error import AccountNotInitializedError
from flask import abort, current_app
from flask import abort, current_app, request
from flask_login import current_user
from services.feature_service import FeatureService
from services.operation_service import OperationService
Expand Down
3 changes: 1 addition & 2 deletions api/controllers/files/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@
api = ExternalApi(bp)


from . import image_preview
from . import tool_files
from . import image_preview, tool_files
4 changes: 2 additions & 2 deletions api/controllers/files/tool_files.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from controllers.files import api
from core.tools.tool_file_manager import ToolFileManager
from flask import Response
from flask_restful import Resource, reqparse
from libs.exception import BaseHTTPException
from werkzeug.exceptions import NotFound, Forbidden
from werkzeug.exceptions import Forbidden, NotFound

from core.tools.tool_file_manager import ToolFileManager

class ToolFilePreviewApi(Resource):
def get(self, file_id, extension):
Expand Down
7 changes: 3 additions & 4 deletions api/controllers/service_api/app/app.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# -*- coding:utf-8 -*-
import json

from controllers.service_api import api
from controllers.service_api.wraps import AppApiResource
from extensions.ext_database import db
from flask import current_app
from flask_restful import fields, marshal_with
from models.model import App, AppModelConfig
from models.tools import ApiToolProvider

import json

from extensions.ext_database import db


class AppParameterApi(AppApiResource):
"""Resource for app variables."""
Expand Down
2 changes: 1 addition & 1 deletion api/controllers/service_api/dataset/dataset.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from models.dataset import Dataset
import services.dataset_service
from controllers.service_api import api
from controllers.service_api.dataset.error import DatasetNameDuplicateError
Expand All @@ -9,6 +8,7 @@
from flask import request
from flask_restful import marshal, reqparse
from libs.login import current_user
from models.dataset import Dataset
from services.dataset_service import DatasetService


Expand Down
3 changes: 1 addition & 2 deletions api/controllers/service_api/index.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from controllers.service_api import api
from flask import current_app
from flask_restful import Resource

from controllers.service_api import api


class IndexApi(Resource):
def get(self):
Expand Down
7 changes: 3 additions & 4 deletions api/controllers/web/app.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# -*- coding:utf-8 -*-
import json

from controllers.web import api
from controllers.web.wraps import WebApiResource
from extensions.ext_database import db
from flask import current_app
from flask_restful import fields, marshal_with
from models.model import App, AppModelConfig
from models.tools import ApiToolProvider

from extensions.ext_database import db

import json


class AppParameterApi(WebApiResource):
"""Resource for app variables."""
Expand Down
16 changes: 9 additions & 7 deletions api/core/app_runner/app_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@
from typing import Generator, List, Optional, Tuple, Union, cast

from core.application_queue_manager import ApplicationQueueManager, PublishFrom
from core.entities.application_entities import AppOrchestrationConfigEntity, ModelConfigEntity, \
PromptTemplateEntity, ExternalDataVariableEntity, ApplicationGenerateEntity, InvokeFrom
from core.entities.application_entities import (ApplicationGenerateEntity, AppOrchestrationConfigEntity,
ExternalDataVariableEntity, InvokeFrom, ModelConfigEntity,
PromptTemplateEntity)
from core.features.annotation_reply import AnnotationReplyFeature
from core.features.external_data_fetch import ExternalDataFetchFeature
from core.features.hosting_moderation import HostingModerationFeature
from core.features.moderation import ModerationFeature
from core.file.file_obj import FileObj
from core.memory.token_buffer_memory import TokenBufferMemory
from core.model_runtime.entities.llm_entities import LLMResult, LLMResultChunk, LLMResultChunkDelta, LLMUsage
from core.model_runtime.entities.message_entities import AssistantPromptMessage, PromptMessage
from core.model_runtime.entities.model_entities import ModelPropertyKey
from core.model_runtime.errors.invoke import InvokeBadRequestError
from core.model_runtime.model_providers.__base.large_language_model import LargeLanguageModel
from core.features.hosting_moderation import HostingModerationFeature
from core.features.moderation import ModerationFeature
from core.features.external_data_fetch import ExternalDataFetchFeature
from core.features.annotation_reply import AnnotationReplyFeature
from core.prompt.prompt_transform import PromptTransform
from models.model import App, MessageAnnotation, Message
from models.model import App, Message, MessageAnnotation


class AppRunner:
def get_pre_calculate_rest_tokens(self, app_record: App,
Expand Down
7 changes: 3 additions & 4 deletions api/core/app_runner/assistant_app_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
from typing import cast

from core.app_runner.app_runner import AppRunner
from core.application_queue_manager import ApplicationQueueManager, PublishFrom
from core.entities.application_entities import AgentEntity, ApplicationGenerateEntity, ModelConfigEntity
from core.features.assistant_cot_runner import AssistantCotApplicationRunner
from core.features.assistant_fc_runner import AssistantFunctionCallApplicationRunner
from core.entities.application_entities import ApplicationGenerateEntity, ModelConfigEntity, \
AgentEntity
from core.application_queue_manager import ApplicationQueueManager, PublishFrom
from core.memory.token_buffer_memory import TokenBufferMemory
from core.model_manager import ModelInstance
from core.model_runtime.entities.llm_entities import LLMUsage
Expand All @@ -16,7 +15,7 @@
from core.moderation.base import ModerationException
from core.tools.entities.tool_entities import ToolRuntimeVariablePool
from extensions.ext_database import db
from models.model import Conversation, Message, App, MessageChain, MessageAgentThought
from models.model import App, Conversation, Message, MessageAgentThought, MessageChain
from models.tools import ToolConversationVariables

logger = logging.getLogger(__name__)
Expand Down
3 changes: 1 addition & 2 deletions api/core/app_runner/basic_app_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
from core.app_runner.app_runner import AppRunner
from core.application_queue_manager import ApplicationQueueManager, PublishFrom
from core.callback_handler.index_tool_callback_handler import DatasetIndexToolCallbackHandler
from core.entities.application_entities import (ApplicationGenerateEntity, DatasetEntity,
InvokeFrom, ModelConfigEntity)
from core.entities.application_entities import ApplicationGenerateEntity, DatasetEntity, InvokeFrom, ModelConfigEntity
from core.features.dataset_retrieval import DatasetRetrievalFeature
from core.memory.token_buffer_memory import TokenBufferMemory
from core.model_manager import ModelInstance
Expand Down
Loading

0 comments on commit 9f637ea

Please sign in to comment.