Spaces:
No application file
No application file
Upload api\controllers\console\__init__.py with huggingface_hub
Browse files
api//controllers//console//__init__.py
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from flask import Blueprint
|
| 2 |
+
|
| 3 |
+
from libs.external_api import ExternalApi
|
| 4 |
+
|
| 5 |
+
from .app.app_import import AppImportApi, AppImportCheckDependenciesApi, AppImportConfirmApi
|
| 6 |
+
from .explore.audio import ChatAudioApi, ChatTextApi
|
| 7 |
+
from .explore.completion import ChatApi, ChatStopApi, CompletionApi, CompletionStopApi
|
| 8 |
+
from .explore.conversation import (
|
| 9 |
+
ConversationApi,
|
| 10 |
+
ConversationListApi,
|
| 11 |
+
ConversationPinApi,
|
| 12 |
+
ConversationRenameApi,
|
| 13 |
+
ConversationUnPinApi,
|
| 14 |
+
)
|
| 15 |
+
from .explore.message import (
|
| 16 |
+
MessageFeedbackApi,
|
| 17 |
+
MessageListApi,
|
| 18 |
+
MessageMoreLikeThisApi,
|
| 19 |
+
MessageSuggestedQuestionApi,
|
| 20 |
+
)
|
| 21 |
+
from .explore.workflow import (
|
| 22 |
+
InstalledAppWorkflowRunApi,
|
| 23 |
+
InstalledAppWorkflowTaskStopApi,
|
| 24 |
+
)
|
| 25 |
+
from .files import FileApi, FilePreviewApi, FileSupportTypeApi
|
| 26 |
+
from .remote_files import RemoteFileInfoApi, RemoteFileUploadApi
|
| 27 |
+
|
| 28 |
+
bp = Blueprint("console", __name__, url_prefix="/console/api")
|
| 29 |
+
api = ExternalApi(bp)
|
| 30 |
+
|
| 31 |
+
# File
|
| 32 |
+
api.add_resource(FileApi, "/files/upload")
|
| 33 |
+
api.add_resource(FilePreviewApi, "/files/<uuid:file_id>/preview")
|
| 34 |
+
api.add_resource(FileSupportTypeApi, "/files/support-type")
|
| 35 |
+
|
| 36 |
+
# Remote files
|
| 37 |
+
api.add_resource(RemoteFileInfoApi, "/remote-files/<path:url>")
|
| 38 |
+
api.add_resource(RemoteFileUploadApi, "/remote-files/upload")
|
| 39 |
+
|
| 40 |
+
# Import App
|
| 41 |
+
api.add_resource(AppImportApi, "/apps/imports")
|
| 42 |
+
api.add_resource(AppImportConfirmApi, "/apps/imports/<string:import_id>/confirm")
|
| 43 |
+
api.add_resource(AppImportCheckDependenciesApi, "/apps/imports/<string:app_id>/check-dependencies")
|
| 44 |
+
|
| 45 |
+
# Import other controllers
|
| 46 |
+
from . import admin, apikey, extension, feature, ping, setup, version
|
| 47 |
+
|
| 48 |
+
# Import app controllers
|
| 49 |
+
from .app import (
|
| 50 |
+
advanced_prompt_template,
|
| 51 |
+
agent,
|
| 52 |
+
annotation,
|
| 53 |
+
app,
|
| 54 |
+
audio,
|
| 55 |
+
completion,
|
| 56 |
+
conversation,
|
| 57 |
+
conversation_variables,
|
| 58 |
+
generator,
|
| 59 |
+
message,
|
| 60 |
+
model_config,
|
| 61 |
+
ops_trace,
|
| 62 |
+
site,
|
| 63 |
+
statistic,
|
| 64 |
+
workflow,
|
| 65 |
+
workflow_app_log,
|
| 66 |
+
workflow_run,
|
| 67 |
+
workflow_statistic,
|
| 68 |
+
)
|
| 69 |
+
|
| 70 |
+
# Import auth controllers
|
| 71 |
+
from .auth import activate, data_source_bearer_auth, data_source_oauth, forgot_password, login, oauth
|
| 72 |
+
|
| 73 |
+
# Import billing controllers
|
| 74 |
+
from .billing import billing
|
| 75 |
+
|
| 76 |
+
# Import datasets controllers
|
| 77 |
+
from .datasets import (
|
| 78 |
+
data_source,
|
| 79 |
+
datasets,
|
| 80 |
+
datasets_document,
|
| 81 |
+
datasets_segments,
|
| 82 |
+
external,
|
| 83 |
+
hit_testing,
|
| 84 |
+
website,
|
| 85 |
+
)
|
| 86 |
+
|
| 87 |
+
# Import explore controllers
|
| 88 |
+
from .explore import (
|
| 89 |
+
installed_app,
|
| 90 |
+
parameter,
|
| 91 |
+
recommended_app,
|
| 92 |
+
saved_message,
|
| 93 |
+
)
|
| 94 |
+
|
| 95 |
+
# Explore Audio
|
| 96 |
+
api.add_resource(ChatAudioApi, "/installed-apps/<uuid:installed_app_id>/audio-to-text", endpoint="installed_app_audio")
|
| 97 |
+
api.add_resource(ChatTextApi, "/installed-apps/<uuid:installed_app_id>/text-to-audio", endpoint="installed_app_text")
|
| 98 |
+
|
| 99 |
+
# Explore Completion
|
| 100 |
+
api.add_resource(
|
| 101 |
+
CompletionApi, "/installed-apps/<uuid:installed_app_id>/completion-messages", endpoint="installed_app_completion"
|
| 102 |
+
)
|
| 103 |
+
api.add_resource(
|
| 104 |
+
CompletionStopApi,
|
| 105 |
+
"/installed-apps/<uuid:installed_app_id>/completion-messages/<string:task_id>/stop",
|
| 106 |
+
endpoint="installed_app_stop_completion",
|
| 107 |
+
)
|
| 108 |
+
api.add_resource(
|
| 109 |
+
ChatApi, "/installed-apps/<uuid:installed_app_id>/chat-messages", endpoint="installed_app_chat_completion"
|
| 110 |
+
)
|
| 111 |
+
api.add_resource(
|
| 112 |
+
ChatStopApi,
|
| 113 |
+
"/installed-apps/<uuid:installed_app_id>/chat-messages/<string:task_id>/stop",
|
| 114 |
+
endpoint="installed_app_stop_chat_completion",
|
| 115 |
+
)
|
| 116 |
+
|
| 117 |
+
# Explore Conversation
|
| 118 |
+
api.add_resource(
|
| 119 |
+
ConversationRenameApi,
|
| 120 |
+
"/installed-apps/<uuid:installed_app_id>/conversations/<uuid:c_id>/name",
|
| 121 |
+
endpoint="installed_app_conversation_rename",
|
| 122 |
+
)
|
| 123 |
+
api.add_resource(
|
| 124 |
+
ConversationListApi, "/installed-apps/<uuid:installed_app_id>/conversations", endpoint="installed_app_conversations"
|
| 125 |
+
)
|
| 126 |
+
api.add_resource(
|
| 127 |
+
ConversationApi,
|
| 128 |
+
"/installed-apps/<uuid:installed_app_id>/conversations/<uuid:c_id>",
|
| 129 |
+
endpoint="installed_app_conversation",
|
| 130 |
+
)
|
| 131 |
+
api.add_resource(
|
| 132 |
+
ConversationPinApi,
|
| 133 |
+
"/installed-apps/<uuid:installed_app_id>/conversations/<uuid:c_id>/pin",
|
| 134 |
+
endpoint="installed_app_conversation_pin",
|
| 135 |
+
)
|
| 136 |
+
api.add_resource(
|
| 137 |
+
ConversationUnPinApi,
|
| 138 |
+
"/installed-apps/<uuid:installed_app_id>/conversations/<uuid:c_id>/unpin",
|
| 139 |
+
endpoint="installed_app_conversation_unpin",
|
| 140 |
+
)
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
# Explore Message
|
| 144 |
+
api.add_resource(MessageListApi, "/installed-apps/<uuid:installed_app_id>/messages", endpoint="installed_app_messages")
|
| 145 |
+
api.add_resource(
|
| 146 |
+
MessageFeedbackApi,
|
| 147 |
+
"/installed-apps/<uuid:installed_app_id>/messages/<uuid:message_id>/feedbacks",
|
| 148 |
+
endpoint="installed_app_message_feedback",
|
| 149 |
+
)
|
| 150 |
+
api.add_resource(
|
| 151 |
+
MessageMoreLikeThisApi,
|
| 152 |
+
"/installed-apps/<uuid:installed_app_id>/messages/<uuid:message_id>/more-like-this",
|
| 153 |
+
endpoint="installed_app_more_like_this",
|
| 154 |
+
)
|
| 155 |
+
api.add_resource(
|
| 156 |
+
MessageSuggestedQuestionApi,
|
| 157 |
+
"/installed-apps/<uuid:installed_app_id>/messages/<uuid:message_id>/suggested-questions",
|
| 158 |
+
endpoint="installed_app_suggested_question",
|
| 159 |
+
)
|
| 160 |
+
# Explore Workflow
|
| 161 |
+
api.add_resource(InstalledAppWorkflowRunApi, "/installed-apps/<uuid:installed_app_id>/workflows/run")
|
| 162 |
+
api.add_resource(
|
| 163 |
+
InstalledAppWorkflowTaskStopApi, "/installed-apps/<uuid:installed_app_id>/workflows/tasks/<string:task_id>/stop"
|
| 164 |
+
)
|
| 165 |
+
|
| 166 |
+
# Import tag controllers
|
| 167 |
+
from .tag import tags
|
| 168 |
+
|
| 169 |
+
# Import workspace controllers
|
| 170 |
+
from .workspace import (
|
| 171 |
+
account,
|
| 172 |
+
agent_providers,
|
| 173 |
+
endpoint,
|
| 174 |
+
load_balancing_config,
|
| 175 |
+
members,
|
| 176 |
+
model_providers,
|
| 177 |
+
models,
|
| 178 |
+
plugin,
|
| 179 |
+
tool_providers,
|
| 180 |
+
workspace,
|
| 181 |
+
)
|