mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-22 10:17:13 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e82918faef | |||
| 8b0f2f58b1 | |||
| 72c03276ff | |||
| d7a034a562 | |||
| c4de3c5168 | |||
| 259e127696 | |||
| 1f0371e177 | |||
| 62d352ce03 | |||
| d06c4287bf | |||
| af80425627 | |||
| 1f3aad6baa |
@@ -113,24 +113,6 @@ class BotsRouterGroup(group.RouterGroup):
|
|||||||
)
|
)
|
||||||
return self.success(data={'sent': True})
|
return self.success(data={'sent': True})
|
||||||
|
|
||||||
@self.route(
|
|
||||||
'/<bot_uuid>/test-inbound',
|
|
||||||
methods=['POST'],
|
|
||||||
auth_type=group.AuthType.USER_TOKEN,
|
|
||||||
permission=Permission.RESOURCE_MANAGE,
|
|
||||||
)
|
|
||||||
async def _(bot_uuid: str, request_context: RequestContext) -> str:
|
|
||||||
json_data = await quart.request.get_json(silent=True) or {}
|
|
||||||
try:
|
|
||||||
result = await self.ap.bot_service.send_http_bot_test_message(
|
|
||||||
request_context,
|
|
||||||
bot_uuid,
|
|
||||||
str(json_data.get('message') or ''),
|
|
||||||
)
|
|
||||||
except ValueError as exc:
|
|
||||||
return self.http_status(400, -1, str(exc))
|
|
||||||
return self.success(data=result)
|
|
||||||
|
|
||||||
@self.route(
|
@self.route(
|
||||||
'/<bot_uuid>/admins',
|
'/<bot_uuid>/admins',
|
||||||
methods=['GET'],
|
methods=['GET'],
|
||||||
|
|||||||
@@ -206,20 +206,6 @@ class SystemRouterGroup(group.RouterGroup):
|
|||||||
|
|
||||||
return self.success(data={})
|
return self.success(data={})
|
||||||
|
|
||||||
@self.route(
|
|
||||||
'/wizard/recommended-model',
|
|
||||||
methods=['GET'],
|
|
||||||
auth_type=group.AuthType.USER_TOKEN,
|
|
||||||
permission=Permission.RESOURCE_MANAGE,
|
|
||||||
)
|
|
||||||
async def _(request_context: RequestContext) -> str:
|
|
||||||
"""Resolve Space's best available chat model to this Workspace."""
|
|
||||||
try:
|
|
||||||
model = await self.ap.space_service.get_recommended_chat_model(request_context)
|
|
||||||
except ValueError as exc:
|
|
||||||
return self.http_status(503, -1, str(exc))
|
|
||||||
return self.success(data=model)
|
|
||||||
|
|
||||||
@self.route(
|
@self.route(
|
||||||
'/tasks',
|
'/tasks',
|
||||||
methods=['GET'],
|
methods=['GET'],
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import uuid
|
import uuid
|
||||||
import json
|
|
||||||
import sqlalchemy
|
import sqlalchemy
|
||||||
|
|
||||||
from ....core import app
|
from ....core import app
|
||||||
@@ -9,8 +8,6 @@ from ....entity.persistence import bot as persistence_bot
|
|||||||
from ....entity.persistence import pipeline as persistence_pipeline
|
from ....entity.persistence import pipeline as persistence_pipeline
|
||||||
from ....workspace.errors import WorkspaceNotFoundError
|
from ....workspace.errors import WorkspaceNotFoundError
|
||||||
from .tenant import TenantContext, require_workspace_uuid, scope_statement
|
from .tenant import TenantContext, require_workspace_uuid, scope_statement
|
||||||
from ....utils import httpclient
|
|
||||||
from ....platform.sources import http_bot_signing
|
|
||||||
|
|
||||||
|
|
||||||
class BotService:
|
class BotService:
|
||||||
@@ -83,7 +80,6 @@ class BotService:
|
|||||||
'wecomcs',
|
'wecomcs',
|
||||||
'LINE',
|
'LINE',
|
||||||
'lark',
|
'lark',
|
||||||
'http_bot',
|
|
||||||
]:
|
]:
|
||||||
webhook_prefix = self.ap.instance_config.data['api'].get('webhook_prefix', 'http://127.0.0.1:5300')
|
webhook_prefix = self.ap.instance_config.data['api'].get('webhook_prefix', 'http://127.0.0.1:5300')
|
||||||
extra_webhook_prefix = self.ap.instance_config.data['api'].get('extra_webhook_prefix', '')
|
extra_webhook_prefix = self.ap.instance_config.data['api'].get('extra_webhook_prefix', '')
|
||||||
@@ -220,53 +216,6 @@ class BotService:
|
|||||||
|
|
||||||
return [log.to_json() for log in logs], total_count
|
return [log.to_json() for log in logs], total_count
|
||||||
|
|
||||||
async def send_http_bot_test_message(
|
|
||||||
self,
|
|
||||||
context: TenantContext,
|
|
||||||
bot_uuid: str,
|
|
||||||
message: str,
|
|
||||||
) -> dict:
|
|
||||||
"""Send a signed test message through the HTTP Bot public ingress."""
|
|
||||||
bot = await self.get_bot(context, bot_uuid, include_secret=True)
|
|
||||||
if bot is None:
|
|
||||||
raise WorkspaceNotFoundError('Bot not found')
|
|
||||||
if bot.get('adapter') != 'http_bot':
|
|
||||||
raise ValueError('Inbound test is only available for HTTP Bot')
|
|
||||||
if not bot.get('enable'):
|
|
||||||
raise ValueError('Bot must be enabled before sending a test message')
|
|
||||||
|
|
||||||
text = message.strip()
|
|
||||||
if not text or len(text) > 2000:
|
|
||||||
raise ValueError('Test message must contain 1 to 2000 characters')
|
|
||||||
|
|
||||||
payload = {
|
|
||||||
'session_id': f'wizard-{uuid.uuid4().hex}',
|
|
||||||
'sender': {'id': 'wizard-user', 'name': 'Wizard Test'},
|
|
||||||
'message': [{'type': 'Plain', 'text': text}],
|
|
||||||
}
|
|
||||||
body = json.dumps(payload, ensure_ascii=False, separators=(',', ':')).encode()
|
|
||||||
config = bot.get('adapter_config') or {}
|
|
||||||
headers = {'Content-Type': 'application/json'}
|
|
||||||
if config.get('signature_required', True):
|
|
||||||
secret = str(config.get('inbound_secret') or '')
|
|
||||||
if not secret:
|
|
||||||
raise ValueError('HTTP Bot inbound signing secret is required')
|
|
||||||
timestamp, signature = http_bot_signing.sign(secret, body)
|
|
||||||
headers[http_bot_signing.HEADER_TIMESTAMP] = timestamp
|
|
||||||
headers[http_bot_signing.HEADER_SIGNATURE] = signature
|
|
||||||
|
|
||||||
port = int(self.ap.instance_config.data.get('api', {}).get('port', 5300))
|
|
||||||
session = httpclient.get_session()
|
|
||||||
async with session.post(
|
|
||||||
f'http://127.0.0.1:{port}/bots/{bot_uuid}',
|
|
||||||
data=body,
|
|
||||||
headers=headers,
|
|
||||||
) as response:
|
|
||||||
result = await httpclient.read_json_limited(response)
|
|
||||||
if response.status not in {200, 202}:
|
|
||||||
raise ValueError(result.get('msg') or f'HTTP Bot test failed with status {response.status}')
|
|
||||||
return result.get('data') or {}
|
|
||||||
|
|
||||||
async def send_message(
|
async def send_message(
|
||||||
self,
|
self,
|
||||||
context: TenantContext,
|
context: TenantContext,
|
||||||
|
|||||||
@@ -11,9 +11,6 @@ import sqlalchemy
|
|||||||
from ....core import app
|
from ....core import app
|
||||||
from ....entity.persistence import user
|
from ....entity.persistence import user
|
||||||
from ....entity.dto.space_model import SpaceModel
|
from ....entity.dto.space_model import SpaceModel
|
||||||
from ....entity.dto.space_model import SpaceModelSelection
|
|
||||||
from ....entity.persistence import model as persistence_model
|
|
||||||
from ....cloud.model_catalog import LANGBOT_MODELS_PROVIDER_REQUESTER
|
|
||||||
|
|
||||||
|
|
||||||
_CREDITS_CACHE_TTL_SECONDS = 60
|
_CREDITS_CACHE_TTL_SECONDS = 60
|
||||||
@@ -241,79 +238,3 @@ class SpaceService:
|
|||||||
raise ValueError(f'Failed to get models: {data.get("msg")}')
|
raise ValueError(f'Failed to get models: {data.get("msg")}')
|
||||||
models_data = data.get('data', {}).get('models', [])
|
models_data = data.get('data', {}).get('models', [])
|
||||||
return [SpaceModel.model_validate(model_dict) for model_dict in models_data]
|
return [SpaceModel.model_validate(model_dict) for model_dict in models_data]
|
||||||
|
|
||||||
async def get_model_selection(self, category: str) -> typing.List[SpaceModelSelection]:
|
|
||||||
"""Return Space models in the availability-ranked selection order."""
|
|
||||||
space_url = self._get_space_config()['url']
|
|
||||||
session = httpclient.get_session()
|
|
||||||
async with session.get(
|
|
||||||
f'{space_url}/api/v1/models/selection',
|
|
||||||
params={'category': category},
|
|
||||||
) as response:
|
|
||||||
if response.status != 200:
|
|
||||||
error = await httpclient.read_text_limited(response)
|
|
||||||
raise ValueError(f'Failed to get model selection: {error}')
|
|
||||||
payload = await httpclient.read_json_limited(response)
|
|
||||||
if payload.get('code') != 0:
|
|
||||||
raise ValueError(f'Failed to get model selection: {payload.get("msg")}')
|
|
||||||
|
|
||||||
data = payload.get('data', [])
|
|
||||||
if isinstance(data, dict):
|
|
||||||
data = data.get('models', data.get('items', []))
|
|
||||||
if not isinstance(data, list):
|
|
||||||
raise ValueError('Failed to get model selection: invalid response')
|
|
||||||
|
|
||||||
models = []
|
|
||||||
for selection in data:
|
|
||||||
if isinstance(selection, dict) and isinstance(selection.get('model'), dict):
|
|
||||||
models.append(selection['model'])
|
|
||||||
else:
|
|
||||||
models.append(selection)
|
|
||||||
return [SpaceModelSelection.model_validate(model) for model in models]
|
|
||||||
|
|
||||||
async def get_recommended_chat_model(self, context: typing.Any) -> dict:
|
|
||||||
"""Resolve Space's first ranked chat model to a local Workspace model."""
|
|
||||||
selection = await self.get_model_selection('chat')
|
|
||||||
if not selection:
|
|
||||||
raise ValueError('No recommended chat model is available')
|
|
||||||
recommended = selection[0]
|
|
||||||
|
|
||||||
async def find_local_model():
|
|
||||||
result = await self.ap.persistence_mgr.execute_async(
|
|
||||||
sqlalchemy.select(persistence_model.LLMModel)
|
|
||||||
.join(
|
|
||||||
persistence_model.ModelProvider,
|
|
||||||
sqlalchemy.and_(
|
|
||||||
persistence_model.ModelProvider.workspace_uuid
|
|
||||||
== persistence_model.LLMModel.workspace_uuid,
|
|
||||||
persistence_model.ModelProvider.uuid == persistence_model.LLMModel.provider_uuid,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.where(
|
|
||||||
persistence_model.LLMModel.workspace_uuid == context.workspace_uuid,
|
|
||||||
persistence_model.ModelProvider.requester == LANGBOT_MODELS_PROVIDER_REQUESTER,
|
|
||||||
sqlalchemy.or_(
|
|
||||||
persistence_model.LLMModel.uuid == recommended.uuid,
|
|
||||||
persistence_model.LLMModel.name == recommended.model_id,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
return result.first()
|
|
||||||
|
|
||||||
local_model = await find_local_model()
|
|
||||||
if local_model is None:
|
|
||||||
# OSS synchronizes the public catalog locally. Refresh once in case
|
|
||||||
# the recommendation was published after this process started.
|
|
||||||
from ..context import ExecutionContext
|
|
||||||
|
|
||||||
try:
|
|
||||||
await self.ap.model_mgr.sync_new_models_from_space(
|
|
||||||
ExecutionContext.from_request(context)
|
|
||||||
)
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
local_model = await find_local_model()
|
|
||||||
|
|
||||||
if local_model is None:
|
|
||||||
raise ValueError('Recommended chat model is not available in this Workspace')
|
|
||||||
return {'uuid': local_model.uuid, 'name': local_model.name}
|
|
||||||
|
|||||||
@@ -47,10 +47,3 @@ class SpaceModel(pydantic.BaseModel):
|
|||||||
status: str
|
status: str
|
||||||
created_at: str | None = None
|
created_at: str | None = None
|
||||||
updated_at: str | None = None
|
updated_at: str | None = None
|
||||||
|
|
||||||
|
|
||||||
class SpaceModelSelection(pydantic.BaseModel):
|
|
||||||
"""Minimal model identity returned by the ranked selection endpoint."""
|
|
||||||
|
|
||||||
uuid: str
|
|
||||||
model_id: str
|
|
||||||
|
|||||||
@@ -1240,14 +1240,6 @@
|
|||||||
// Root container
|
// Root container
|
||||||
var root = document.createElement("div");
|
var root = document.createElement("div");
|
||||||
root.id = "langbot-widget-root";
|
root.id = "langbot-widget-root";
|
||||||
root.langbotDestroy = function () {
|
|
||||||
wsDisconnect();
|
|
||||||
if (state.historyReloadTimer) {
|
|
||||||
clearTimeout(state.historyReloadTimer);
|
|
||||||
state.historyReloadTimer = null;
|
|
||||||
}
|
|
||||||
root.remove();
|
|
||||||
};
|
|
||||||
document.body.appendChild(root);
|
document.body.appendChild(root);
|
||||||
|
|
||||||
var shadow = root.attachShadow({ mode: "open" });
|
var shadow = root.attachShadow({ mode: "open" });
|
||||||
|
|||||||
@@ -9,9 +9,8 @@ Source: src/langbot/pkg/api/http/service/bot.py
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from unittest.mock import AsyncMock, MagicMock, Mock, patch
|
from unittest.mock import AsyncMock, Mock, patch
|
||||||
from types import SimpleNamespace
|
from types import SimpleNamespace
|
||||||
import json
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from langbot.pkg.api.http.service.bot import BotService
|
from langbot.pkg.api.http.service.bot import BotService
|
||||||
@@ -242,29 +241,6 @@ class TestBotServiceGetRuntimeBotInfo:
|
|||||||
assert result['adapter_runtime_values']['webhook_url'] == '/bots/wecom-uuid'
|
assert result['adapter_runtime_values']['webhook_url'] == '/bots/wecom-uuid'
|
||||||
assert result['adapter_runtime_values']['webhook_full_url'] == 'http://127.0.0.1:5300/bots/wecom-uuid'
|
assert result['adapter_runtime_values']['webhook_full_url'] == 'http://127.0.0.1:5300/bots/wecom-uuid'
|
||||||
|
|
||||||
async def test_get_runtime_bot_info_returns_webhook_for_http_bot(self):
|
|
||||||
ap = SimpleNamespace(
|
|
||||||
instance_config=SimpleNamespace(
|
|
||||||
data={'api': {'webhook_prefix': 'https://bot.example.com'}}
|
|
||||||
),
|
|
||||||
platform_mgr=SimpleNamespace(get_bot_by_uuid=AsyncMock(return_value=None)),
|
|
||||||
)
|
|
||||||
service = BotService(ap)
|
|
||||||
service.get_bot = AsyncMock(
|
|
||||||
return_value={
|
|
||||||
'uuid': 'http-bot-uuid',
|
|
||||||
'name': 'HTTP Bot',
|
|
||||||
'adapter': 'http_bot',
|
|
||||||
'adapter_config': {},
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
result = await service.get_runtime_bot_info(WORKSPACE_UUID, 'http-bot-uuid')
|
|
||||||
|
|
||||||
assert result['adapter_runtime_values']['webhook_full_url'] == (
|
|
||||||
'https://bot.example.com/bots/http-bot-uuid'
|
|
||||||
)
|
|
||||||
|
|
||||||
async def test_get_runtime_bot_info_no_webhook_for_telegram(self):
|
async def test_get_runtime_bot_info_no_webhook_for_telegram(self):
|
||||||
"""Returns no webhook URL for non-webhook adapters like telegram."""
|
"""Returns no webhook URL for non-webhook adapters like telegram."""
|
||||||
# Setup
|
# Setup
|
||||||
@@ -629,77 +605,6 @@ class TestBotServiceListEventLogs:
|
|||||||
assert total == 5
|
assert total == 5
|
||||||
|
|
||||||
|
|
||||||
class TestBotServiceHttpBotInboundTest:
|
|
||||||
async def test_sends_signed_message_through_public_ingress(self):
|
|
||||||
ap = SimpleNamespace(
|
|
||||||
instance_config=SimpleNamespace(data={'api': {'port': 5300}}),
|
|
||||||
)
|
|
||||||
service = BotService(ap)
|
|
||||||
service.get_bot = AsyncMock(
|
|
||||||
return_value={
|
|
||||||
'uuid': 'http-bot-uuid',
|
|
||||||
'adapter': 'http_bot',
|
|
||||||
'adapter_config': {
|
|
||||||
'signature_required': True,
|
|
||||||
'inbound_secret': 'test-secret',
|
|
||||||
},
|
|
||||||
'enable': True,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
response = MagicMock(status=202)
|
|
||||||
session = MagicMock()
|
|
||||||
session.post.return_value.__aenter__ = AsyncMock(return_value=response)
|
|
||||||
session.post.return_value.__aexit__ = AsyncMock(return_value=None)
|
|
||||||
|
|
||||||
with (
|
|
||||||
patch('langbot.pkg.api.http.service.bot.httpclient.get_session', return_value=session),
|
|
||||||
patch(
|
|
||||||
'langbot.pkg.api.http.service.bot.httpclient.read_json_limited',
|
|
||||||
new=AsyncMock(
|
|
||||||
return_value={
|
|
||||||
'code': 0,
|
|
||||||
'data': {
|
|
||||||
'session_id': 'wizard-session',
|
|
||||||
'accepted_message_id': 'in-message',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
),
|
|
||||||
),
|
|
||||||
):
|
|
||||||
result = await service.send_http_bot_test_message(
|
|
||||||
WORKSPACE_UUID,
|
|
||||||
'http-bot-uuid',
|
|
||||||
'hello',
|
|
||||||
)
|
|
||||||
|
|
||||||
assert result['accepted_message_id'] == 'in-message'
|
|
||||||
request = session.post.call_args
|
|
||||||
assert request.args[0] == 'http://127.0.0.1:5300/bots/http-bot-uuid'
|
|
||||||
payload = json.loads(request.kwargs['data'])
|
|
||||||
assert payload['message'] == [{'type': 'Plain', 'text': 'hello'}]
|
|
||||||
headers = request.kwargs['headers']
|
|
||||||
assert headers['X-LB-Timestamp']
|
|
||||||
assert headers['X-LB-Signature'].startswith('sha256=')
|
|
||||||
|
|
||||||
async def test_rejects_non_http_bot(self):
|
|
||||||
service = BotService(SimpleNamespace())
|
|
||||||
service.get_bot = AsyncMock(
|
|
||||||
return_value={
|
|
||||||
'uuid': 'telegram-bot',
|
|
||||||
'adapter': 'telegram',
|
|
||||||
'adapter_config': {},
|
|
||||||
'enable': True,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
with pytest.raises(ValueError, match='only available for HTTP Bot'):
|
|
||||||
await service.send_http_bot_test_message(
|
|
||||||
WORKSPACE_UUID,
|
|
||||||
'telegram-bot',
|
|
||||||
'hello',
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class TestBotServiceSendMessage:
|
class TestBotServiceSendMessage:
|
||||||
"""Tests for send_message method."""
|
"""Tests for send_message method."""
|
||||||
|
|
||||||
|
|||||||
@@ -820,100 +820,6 @@ class TestSpaceServiceGetModels:
|
|||||||
await service.get_models()
|
await service.get_models()
|
||||||
|
|
||||||
|
|
||||||
class TestSpaceServiceGetModelSelection:
|
|
||||||
"""Tests for availability-ranked model selection."""
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('response_shape', ['direct', 'models-envelope', 'availability-wrapper'])
|
|
||||||
async def test_preserves_selection_order_and_category_query(self, response_shape):
|
|
||||||
ap = SimpleNamespace(instance_config=SimpleNamespace(data={}))
|
|
||||||
service = SpaceService(ap)
|
|
||||||
models = [
|
|
||||||
{
|
|
||||||
'uuid': 'best-model',
|
|
||||||
'model_id': 'best-chat-model',
|
|
||||||
'provider': 'provider-1',
|
|
||||||
'category': 'chat',
|
|
||||||
'status': 'active',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'uuid': 'fallback-model',
|
|
||||||
'model_id': 'fallback-chat-model',
|
|
||||||
'provider': 'provider-2',
|
|
||||||
'category': 'chat',
|
|
||||||
'status': 'active',
|
|
||||||
},
|
|
||||||
]
|
|
||||||
if response_shape == 'models-envelope':
|
|
||||||
data = {'models': models}
|
|
||||||
elif response_shape == 'availability-wrapper':
|
|
||||||
data = [
|
|
||||||
{'model': model, 'latency_ms': index + 10, 'http_code': 200}
|
|
||||||
for index, model in enumerate(models)
|
|
||||||
]
|
|
||||||
else:
|
|
||||||
data = models
|
|
||||||
payload = {'code': 0, 'data': data}
|
|
||||||
mock_response = MagicMock(status=200)
|
|
||||||
|
|
||||||
with (
|
|
||||||
patch('langbot.pkg.api.http.service.space.httpclient.get_session') as get_session,
|
|
||||||
patch(
|
|
||||||
'langbot.pkg.api.http.service.space.httpclient.read_json_limited',
|
|
||||||
new=AsyncMock(return_value=payload),
|
|
||||||
),
|
|
||||||
):
|
|
||||||
session = MagicMock()
|
|
||||||
session.get.return_value.__aenter__ = AsyncMock(return_value=mock_response)
|
|
||||||
session.get.return_value.__aexit__ = AsyncMock(return_value=None)
|
|
||||||
get_session.return_value = session
|
|
||||||
|
|
||||||
result = await service.get_model_selection('chat')
|
|
||||||
|
|
||||||
assert [model.uuid for model in result] == ['best-model', 'fallback-model']
|
|
||||||
session.get.assert_called_once_with(
|
|
||||||
'https://space.langbot.app/api/v1/models/selection',
|
|
||||||
params={'category': 'chat'},
|
|
||||||
)
|
|
||||||
|
|
||||||
async def test_recommended_model_uses_first_selection_and_refreshes_once(self):
|
|
||||||
local_model = SimpleNamespace(uuid='local-model-uuid', name='best-chat-model')
|
|
||||||
persistence = SimpleNamespace(
|
|
||||||
execute_async=AsyncMock(
|
|
||||||
side_effect=[
|
|
||||||
_create_mock_result(first_item=None),
|
|
||||||
_create_mock_result(first_item=local_model),
|
|
||||||
]
|
|
||||||
)
|
|
||||||
)
|
|
||||||
model_mgr = SimpleNamespace(sync_new_models_from_space=AsyncMock())
|
|
||||||
ap = SimpleNamespace(
|
|
||||||
instance_config=SimpleNamespace(data={}),
|
|
||||||
persistence_mgr=persistence,
|
|
||||||
model_mgr=model_mgr,
|
|
||||||
)
|
|
||||||
service = SpaceService(ap)
|
|
||||||
service.get_model_selection = AsyncMock(
|
|
||||||
return_value=[
|
|
||||||
SimpleNamespace(uuid='best-upstream-uuid', model_id='best-chat-model'),
|
|
||||||
SimpleNamespace(uuid='fallback-upstream-uuid', model_id='fallback-chat-model'),
|
|
||||||
]
|
|
||||||
)
|
|
||||||
context = SimpleNamespace(
|
|
||||||
instance_uuid='instance',
|
|
||||||
workspace_uuid='workspace',
|
|
||||||
placement_generation=1,
|
|
||||||
principal=SimpleNamespace(),
|
|
||||||
entitlement_revision=0,
|
|
||||||
)
|
|
||||||
|
|
||||||
result = await service.get_recommended_chat_model(context)
|
|
||||||
|
|
||||||
assert result == {'uuid': 'local-model-uuid', 'name': 'best-chat-model'}
|
|
||||||
service.get_model_selection.assert_awaited_once_with('chat')
|
|
||||||
model_mgr.sync_new_models_from_space.assert_awaited_once()
|
|
||||||
assert persistence.execute_async.await_count == 2
|
|
||||||
|
|
||||||
|
|
||||||
class TestSpaceServiceCreditsCache:
|
class TestSpaceServiceCreditsCache:
|
||||||
"""Tests for credits cache behavior."""
|
"""Tests for credits cache behavior."""
|
||||||
|
|
||||||
|
|||||||
+1
-5
@@ -1,5 +1 @@
|
|||||||
# Leave empty in development to use Vite's same-origin proxy. This keeps API,
|
VITE_API_BASE_URL=http://localhost:5300
|
||||||
# login, and WebSocket requests working when the UI is opened from another
|
|
||||||
# device on the local network.
|
|
||||||
VITE_API_BASE_URL=
|
|
||||||
VITE_API_PROXY_TARGET=http://127.0.0.1:5300
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ export function BotLogListComponent({
|
|||||||
autoExpandImages = false,
|
autoExpandImages = false,
|
||||||
hideDetailedLogsLink = false,
|
hideDetailedLogsLink = false,
|
||||||
hideToolbar = false,
|
hideToolbar = false,
|
||||||
onMessageReceived,
|
|
||||||
}: {
|
}: {
|
||||||
botId: string;
|
botId: string;
|
||||||
/** When true, log entries with images are rendered expanded by default */
|
/** When true, log entries with images are rendered expanded by default */
|
||||||
@@ -29,8 +28,6 @@ export function BotLogListComponent({
|
|||||||
hideDetailedLogsLink?: boolean;
|
hideDetailedLogsLink?: boolean;
|
||||||
/** When true, hides the entire toolbar (auto-refresh, level filter, detailed logs link) */
|
/** When true, hides the entire toolbar (auto-refresh, level filter, detailed logs link) */
|
||||||
hideToolbar?: boolean;
|
hideToolbar?: boolean;
|
||||||
/** Called after an inbound person/group message appears in the bot log. */
|
|
||||||
onMessageReceived?: () => void;
|
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -44,8 +41,6 @@ export function BotLogListComponent({
|
|||||||
]);
|
]);
|
||||||
const listContainerRef = useRef<HTMLDivElement>(null);
|
const listContainerRef = useRef<HTMLDivElement>(null);
|
||||||
const botLogListRef = useRef<BotLog[]>(botLogList);
|
const botLogListRef = useRef<BotLog[]>(botLogList);
|
||||||
const onMessageReceivedRef = useRef(onMessageReceived);
|
|
||||||
onMessageReceivedRef.current = onMessageReceived;
|
|
||||||
|
|
||||||
const logLevels = [
|
const logLevels = [
|
||||||
{ value: 'error', label: 'ERROR' },
|
{ value: 'error', label: 'ERROR' },
|
||||||
@@ -113,9 +108,6 @@ export function BotLogListComponent({
|
|||||||
manager.subscribeLogPush(handleBotLogPush);
|
manager.subscribeLogPush(handleBotLogPush);
|
||||||
manager.loadFirstPage().then((response) => {
|
manager.loadFirstPage().then((response) => {
|
||||||
setBotLogList(response.reverse());
|
setBotLogList(response.reverse());
|
||||||
if (response.some((log) => Boolean(log.message_session_id))) {
|
|
||||||
onMessageReceivedRef.current?.();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
listenScroll();
|
listenScroll();
|
||||||
}
|
}
|
||||||
@@ -146,9 +138,6 @@ export function BotLogListComponent({
|
|||||||
|
|
||||||
function handleBotLogPush(response: BotLog[]) {
|
function handleBotLogPush(response: BotLog[]) {
|
||||||
setBotLogList(response.reverse());
|
setBotLogList(response.reverse());
|
||||||
if (response.some((log) => Boolean(log.message_session_id))) {
|
|
||||||
onMessageReceivedRef.current?.();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleScroll = useCallback(
|
const handleScroll = useCallback(
|
||||||
|
|||||||
@@ -31,14 +31,27 @@ const getFormSchema = (t: (key: string) => string) =>
|
|||||||
api_key: z.string().optional(),
|
api_key: z.string().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export interface ProviderFormInitialValues {
|
||||||
|
name?: string;
|
||||||
|
requester?: string;
|
||||||
|
base_url?: string;
|
||||||
|
api_key?: string;
|
||||||
|
}
|
||||||
|
|
||||||
interface ProviderFormProps {
|
interface ProviderFormProps {
|
||||||
providerId?: string;
|
providerId?: string;
|
||||||
onFormSubmit: () => void;
|
initialValues?: ProviderFormInitialValues;
|
||||||
|
onValuesChange?: (values: ProviderFormInitialValues) => void;
|
||||||
|
submitButtonText?: string;
|
||||||
|
onFormSubmit: (providerUuid?: string) => void;
|
||||||
onFormCancel: () => void;
|
onFormCancel: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ProviderForm({
|
export default function ProviderForm({
|
||||||
providerId,
|
providerId,
|
||||||
|
initialValues,
|
||||||
|
onValuesChange,
|
||||||
|
submitButtonText,
|
||||||
onFormSubmit,
|
onFormSubmit,
|
||||||
onFormCancel,
|
onFormCancel,
|
||||||
}: ProviderFormProps) {
|
}: ProviderFormProps) {
|
||||||
@@ -48,13 +61,22 @@ export default function ProviderForm({
|
|||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
name: '',
|
name: initialValues?.name ?? '',
|
||||||
requester: '',
|
requester: initialValues?.requester ?? '',
|
||||||
base_url: '',
|
base_url: initialValues?.base_url ?? '',
|
||||||
api_key: '',
|
api_key: initialValues?.api_key ?? '',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const { setValue } = form;
|
const { setValue, watch } = form;
|
||||||
|
|
||||||
|
// Report form values changes to parent
|
||||||
|
useEffect(() => {
|
||||||
|
if (!onValuesChange) return;
|
||||||
|
const subscription = watch((values) => {
|
||||||
|
onValuesChange(values as ProviderFormInitialValues);
|
||||||
|
});
|
||||||
|
return () => subscription.unsubscribe();
|
||||||
|
}, [watch, onValuesChange]);
|
||||||
|
|
||||||
const [requesterList, setRequesterList] = useState<
|
const [requesterList, setRequesterList] = useState<
|
||||||
{
|
{
|
||||||
@@ -174,11 +196,12 @@ export default function ProviderForm({
|
|||||||
if (providerId) {
|
if (providerId) {
|
||||||
await httpClient.updateModelProvider(providerId, data);
|
await httpClient.updateModelProvider(providerId, data);
|
||||||
toast.success(t('models.providerSaved'));
|
toast.success(t('models.providerSaved'));
|
||||||
|
onFormSubmit();
|
||||||
} else {
|
} else {
|
||||||
await httpClient.createModelProvider(data);
|
const resp = await httpClient.createModelProvider(data);
|
||||||
toast.success(t('models.providerCreated'));
|
toast.success(t('models.providerCreated'));
|
||||||
|
onFormSubmit(resp.uuid);
|
||||||
}
|
}
|
||||||
onFormSubmit();
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
toast.error(t('models.providerSaveError') + (err as CustomApiError).msg);
|
toast.error(t('models.providerSaveError') + (err as CustomApiError).msg);
|
||||||
}
|
}
|
||||||
@@ -378,7 +401,7 @@ export default function ProviderForm({
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
<Button type="submit">{t('common.save')}</Button>
|
<Button type="submit">{submitButtonText || t('common.save')}</Button>
|
||||||
<Button type="button" variant="outline" onClick={onFormCancel}>
|
<Button type="button" variant="outline" onClick={onFormCancel}>
|
||||||
{t('common.cancel')}
|
{t('common.cancel')}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -363,9 +363,7 @@ export interface WizardProgress {
|
|||||||
step: number;
|
step: number;
|
||||||
selected_adapter: string | null;
|
selected_adapter: string | null;
|
||||||
created_bot_uuid: string | null;
|
created_bot_uuid: string | null;
|
||||||
created_pipeline_uuid?: string | null;
|
|
||||||
bot_saved: boolean;
|
bot_saved: boolean;
|
||||||
message_received?: boolean;
|
|
||||||
selected_runner: string | null;
|
selected_runner: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -461,15 +461,6 @@ export class BackendClient extends BaseHttpClient {
|
|||||||
return this.post(`/api/v1/platform/bots/${botId}/logs`, request);
|
return this.post(`/api/v1/platform/bots/${botId}/logs`, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public testHttpBotInbound(
|
|
||||||
botId: string,
|
|
||||||
message: string,
|
|
||||||
): Promise<{ session_id: string; accepted_message_id: string }> {
|
|
||||||
return this.post(`/api/v1/platform/bots/${botId}/test-inbound`, {
|
|
||||||
message,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public getBotSessions(
|
public getBotSessions(
|
||||||
botId: string,
|
botId: string,
|
||||||
limit: number = 100,
|
limit: number = 100,
|
||||||
@@ -1055,21 +1046,12 @@ export class BackendClient extends BaseHttpClient {
|
|||||||
step: number;
|
step: number;
|
||||||
selected_adapter: string | null;
|
selected_adapter: string | null;
|
||||||
created_bot_uuid: string | null;
|
created_bot_uuid: string | null;
|
||||||
created_pipeline_uuid?: string | null;
|
|
||||||
bot_saved: boolean;
|
bot_saved: boolean;
|
||||||
message_received?: boolean;
|
|
||||||
selected_runner: string | null;
|
selected_runner: string | null;
|
||||||
}): Promise<void> {
|
}): Promise<void> {
|
||||||
return this.put('/api/v1/system/wizard/progress', progress);
|
return this.put('/api/v1/system/wizard/progress', progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getWizardRecommendedModel(): Promise<{
|
|
||||||
uuid: string;
|
|
||||||
name: string;
|
|
||||||
}> {
|
|
||||||
return this.get('/api/v1/system/wizard/recommended-model');
|
|
||||||
}
|
|
||||||
|
|
||||||
public getAsyncTasks(params?: {
|
public getAsyncTasks(params?: {
|
||||||
type?: string;
|
type?: string;
|
||||||
kind?: string;
|
kind?: string;
|
||||||
|
|||||||
+849
-497
File diff suppressed because it is too large
Load Diff
@@ -1827,23 +1827,6 @@ const enUS = {
|
|||||||
resaveBot: 'Re-save Configuration',
|
resaveBot: 'Re-save Configuration',
|
||||||
botSaved:
|
botSaved:
|
||||||
'Bot configuration saved and enabled. Check the logs to verify the connection.',
|
'Bot configuration saved and enabled. Check the logs to verify the connection.',
|
||||||
waitingForMessage:
|
|
||||||
'The bot is enabled. Send it a message from your IM platform to continue.',
|
|
||||||
messageReceived:
|
|
||||||
'The bot received an IM message. You can continue to the next step.',
|
|
||||||
pageBotTestPrompt:
|
|
||||||
'Page Bot is enabled. Click the chat bubble in the lower-right corner and send a message to verify the full conversation flow.',
|
|
||||||
webhookTestPrompt:
|
|
||||||
'The callback URL is ready. Configure it on the external platform, then send the bot a real message.',
|
|
||||||
httpTestPrompt:
|
|
||||||
'HTTP Bot is enabled. Send a real inbound message here to verify the connection.',
|
|
||||||
httpTestDefaultMessage: 'Hello, this is a connection test message.',
|
|
||||||
sendHttpTest: 'Send Test Message',
|
|
||||||
httpTestAccepted:
|
|
||||||
'The test message was accepted. It will appear in the log shortly.',
|
|
||||||
httpTestMissingSecret:
|
|
||||||
'Enter an inbound signing secret and save the configuration first.',
|
|
||||||
httpTestFailed: 'Failed to send the test message: {{error}}',
|
|
||||||
logsTitle: 'Bot Logs',
|
logsTitle: 'Bot Logs',
|
||||||
logsDescription:
|
logsDescription:
|
||||||
'Monitor bot activity to verify the platform connection is working.',
|
'Monitor bot activity to verify the platform connection is working.',
|
||||||
@@ -1852,29 +1835,63 @@ const enUS = {
|
|||||||
title: 'Select an AI Engine',
|
title: 'Select an AI Engine',
|
||||||
description:
|
description:
|
||||||
"Choose the AI engine that will power your bot's intelligence.",
|
"Choose the AI engine that will power your bot's intelligence.",
|
||||||
optionalDescription:
|
orchestrated: {
|
||||||
'This step is optional. Choose how you want to continue with the current agent.',
|
title: 'Use Orchestrated Agent Apps',
|
||||||
externalTitle: 'Connect an External Agent',
|
description:
|
||||||
externalDescription:
|
'Use pre-built Agent apps from Dify, n8n, Coze, and more.',
|
||||||
'Connect Dify, n8n, Coze, or another platform and replace the bot pipeline.',
|
action: 'Select Agent App',
|
||||||
ownModelTitle: 'Use My Own Model',
|
selectTitle: 'Select Agent App',
|
||||||
ownModelDescription:
|
selectDescription: 'Choose the Agent app platform you want to use.',
|
||||||
'Open the current Local Agent pipeline and configure your own model.',
|
},
|
||||||
moreFeaturesTitle: 'Add More Agent Features',
|
llm: {
|
||||||
moreFeaturesDescription:
|
title: 'Use LLM Directly',
|
||||||
'Open the workbench to add tools, knowledge, and other capabilities.',
|
description:
|
||||||
runnerDescription:
|
'Configure a model provider and use LLM to drive your bot directly.',
|
||||||
'Select a runner for the external agent and configure its connection.',
|
action: 'Configure LLM',
|
||||||
backToChoices: 'Back to options',
|
},
|
||||||
createExternal: 'Create and Bind',
|
|
||||||
configurePipeline: 'Configure Pipeline',
|
|
||||||
openWorkbench: 'Open Workbench',
|
|
||||||
},
|
},
|
||||||
spaceBanner: {
|
spaceBanner: {
|
||||||
message:
|
message:
|
||||||
'Connect to LangBot Space for free trial model credits and zero-config instant setup!',
|
'Connect to LangBot Space for free trial model credits and zero-config instant setup!',
|
||||||
action: 'Authorize with Space',
|
action: 'Authorize with Space',
|
||||||
},
|
},
|
||||||
|
provider: {
|
||||||
|
title: 'Add Model Provider',
|
||||||
|
description:
|
||||||
|
'Add your own model provider. Configure the API key to get started.',
|
||||||
|
scanTitle: 'Scan Available Models',
|
||||||
|
scanDescription: 'Scanning your provider for available LLM models.',
|
||||||
|
scanning: 'Scanning models...',
|
||||||
|
noModelsFound: 'No models found. Please check your provider config.',
|
||||||
|
addSelected: 'Add {{count}} selected model(s)',
|
||||||
|
modelsAdded: 'Added {{count}} model(s)',
|
||||||
|
modelsAddError: 'Failed to add models',
|
||||||
|
skipModelAdd: 'Skip, add later',
|
||||||
|
searchModels: 'Search models...',
|
||||||
|
noMatch: 'No matching models',
|
||||||
|
orDivider: 'or',
|
||||||
|
manualModelPlaceholder: 'Enter model name to add manually',
|
||||||
|
addManual: 'Add',
|
||||||
|
saveAndNext: 'Save & Next',
|
||||||
|
alreadyAdded: 'Added',
|
||||||
|
modelAlreadyExists: 'Model "{{name}}" already exists',
|
||||||
|
},
|
||||||
|
modelSource: {
|
||||||
|
title: 'Choose Model Source',
|
||||||
|
description: 'Select how to provide model capabilities for your AI engine.',
|
||||||
|
space: {
|
||||||
|
title: 'LangBot Service',
|
||||||
|
description:
|
||||||
|
'Zero-config ready with free trial model credits. No API key needed — just plug and play.',
|
||||||
|
action: 'Use LangBot Service',
|
||||||
|
},
|
||||||
|
custom: {
|
||||||
|
title: 'Custom Model',
|
||||||
|
description:
|
||||||
|
'Bring your own model API key. Supports OpenAI, Claude, Gemini, and more.',
|
||||||
|
action: 'Add My Own Model',
|
||||||
|
},
|
||||||
|
},
|
||||||
config: {
|
config: {
|
||||||
botInfo: 'Bot Information',
|
botInfo: 'Bot Information',
|
||||||
botNamePlaceholder: 'Enter bot name',
|
botNamePlaceholder: 'Enter bot name',
|
||||||
|
|||||||
@@ -1691,12 +1691,66 @@ const esES = {
|
|||||||
title: 'Selecciona un motor de IA',
|
title: 'Selecciona un motor de IA',
|
||||||
description:
|
description:
|
||||||
'Elige el motor de IA que impulsará la inteligencia de tu Bot.',
|
'Elige el motor de IA que impulsará la inteligencia de tu Bot.',
|
||||||
|
orchestrated: {
|
||||||
|
title: 'Usar aplicaciones Agent orquestadas',
|
||||||
|
description:
|
||||||
|
'Usar aplicaciones Agent predefinidas de Dify, n8n, Coze y más.',
|
||||||
|
action: 'Seleccionar aplicación Agent',
|
||||||
|
selectTitle: 'Seleccionar aplicación Agent',
|
||||||
|
selectDescription:
|
||||||
|
'Elige la plataforma de aplicación Agent que deseas usar.',
|
||||||
|
},
|
||||||
|
llm: {
|
||||||
|
title: 'Usar modelo directamente',
|
||||||
|
description:
|
||||||
|
'Configurar un proveedor de modelos y usar el modelo para impulsar tu Bot.',
|
||||||
|
action: 'Configurar modelo',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
spaceBanner: {
|
spaceBanner: {
|
||||||
message:
|
message:
|
||||||
'¡Conéctate a LangBot Space para obtener créditos de prueba gratuitos y configuración instantánea sin esfuerzo!',
|
'¡Conéctate a LangBot Space para obtener créditos de prueba gratuitos y configuración instantánea sin esfuerzo!',
|
||||||
action: 'Autorizar con Space',
|
action: 'Autorizar con Space',
|
||||||
},
|
},
|
||||||
|
provider: {
|
||||||
|
title: 'Agregar proveedor de modelos',
|
||||||
|
description:
|
||||||
|
'Agrega tu propio proveedor de modelos. Configura la API key para comenzar.',
|
||||||
|
scanTitle: 'Escanear modelos disponibles',
|
||||||
|
scanDescription: 'Escaneando modelos LLM de tu proveedor.',
|
||||||
|
scanning: 'Escaneando modelos...',
|
||||||
|
noModelsFound:
|
||||||
|
'No se encontraron modelos. Verifica la configuración del proveedor.',
|
||||||
|
addSelected: 'Agregar {{count}} modelo(s) seleccionado(s)',
|
||||||
|
modelsAdded: '{{count}} modelo(s) agregado(s)',
|
||||||
|
modelsAddError: 'Error al agregar modelos',
|
||||||
|
skipModelAdd: 'Omitir, agregar después',
|
||||||
|
searchModels: 'Buscar modelos...',
|
||||||
|
noMatch: 'No hay modelos coincidentes',
|
||||||
|
orDivider: 'o',
|
||||||
|
manualModelPlaceholder: 'Ingresa el nombre del modelo para agregar manualmente',
|
||||||
|
addManual: 'Agregar',
|
||||||
|
saveAndNext: 'Guardar y siguiente',
|
||||||
|
alreadyAdded: 'Agregado',
|
||||||
|
modelAlreadyExists: 'El modelo "{{name}}" ya existe',
|
||||||
|
},
|
||||||
|
modelSource: {
|
||||||
|
title: 'Elegir fuente del modelo',
|
||||||
|
description:
|
||||||
|
'Selecciona cómo proporcionar capacidades de modelo para tu motor de IA.',
|
||||||
|
space: {
|
||||||
|
title: 'Servicio LangBot',
|
||||||
|
description:
|
||||||
|
'Listo para usar sin configuración, con créditos de prueba gratuitos. No se necesita API key.',
|
||||||
|
action: 'Usar servicio LangBot',
|
||||||
|
},
|
||||||
|
custom: {
|
||||||
|
title: 'Modelo personalizado',
|
||||||
|
description:
|
||||||
|
'Usa tu propia API key. Compatible con OpenAI, Claude, Gemini y más.',
|
||||||
|
action: 'Agregar mi propio modelo',
|
||||||
|
},
|
||||||
|
},
|
||||||
config: {
|
config: {
|
||||||
botInfo: 'Información del Bot',
|
botInfo: 'Información del Bot',
|
||||||
botNamePlaceholder: 'Introduce el nombre del Bot',
|
botNamePlaceholder: 'Introduce el nombre del Bot',
|
||||||
|
|||||||
@@ -1744,23 +1744,6 @@ const jaJP = {
|
|||||||
resaveBot: '設定を再保存',
|
resaveBot: '設定を再保存',
|
||||||
botSaved:
|
botSaved:
|
||||||
'ボット設定が保存され、有効になりました。ログを確認して接続を検証してください。',
|
'ボット設定が保存され、有効になりました。ログを確認して接続を検証してください。',
|
||||||
waitingForMessage:
|
|
||||||
'ボットが有効になりました。続行するには IM からメッセージを送信してください。',
|
|
||||||
messageReceived:
|
|
||||||
'ボットが IM メッセージを受信しました。次のステップに進めます。',
|
|
||||||
pageBotTestPrompt:
|
|
||||||
'ページボットが有効になりました。右下のチャットバブルをクリックしてメッセージを送信し、会話フロー全体を確認してください。',
|
|
||||||
webhookTestPrompt:
|
|
||||||
'コールバック URL の準備ができました。外部プラットフォームに設定し、ボットへ実際のメッセージを送信してください。',
|
|
||||||
httpTestPrompt:
|
|
||||||
'HTTP Bot が有効になりました。実際の受信メッセージを送信して接続を確認できます。',
|
|
||||||
httpTestDefaultMessage: 'こんにちは。これは接続テストメッセージです。',
|
|
||||||
sendHttpTest: 'テストメッセージを送信',
|
|
||||||
httpTestAccepted:
|
|
||||||
'テストメッセージを受け付けました。まもなくログに表示されます。',
|
|
||||||
httpTestMissingSecret:
|
|
||||||
'受信署名シークレットを入力し、先に設定を保存してください。',
|
|
||||||
httpTestFailed: 'テストメッセージの送信に失敗しました:{{error}}',
|
|
||||||
logsTitle: 'ボットログ',
|
logsTitle: 'ボットログ',
|
||||||
logsDescription:
|
logsDescription:
|
||||||
'ボットの活動を監視して、プラットフォーム接続が正常に動作していることを確認します。',
|
'ボットの活動を監視して、プラットフォーム接続が正常に動作していることを確認します。',
|
||||||
@@ -1769,28 +1752,65 @@ const jaJP = {
|
|||||||
title: 'AIエンジンを選択',
|
title: 'AIエンジンを選択',
|
||||||
description:
|
description:
|
||||||
'ボットのインテリジェンスを駆動するAIエンジンを選択してください。',
|
'ボットのインテリジェンスを駆動するAIエンジンを選択してください。',
|
||||||
optionalDescription:
|
orchestrated: {
|
||||||
'このステップは任意です。現在の Agent をどのように設定するか選択してください。',
|
title: 'オーケストレーション済みAgentアプリを使用',
|
||||||
externalTitle: '外部プラットフォームの Agent を接続',
|
description:
|
||||||
externalDescription:
|
'Dify、n8n、Cozeなどのプラットフォームで構築済みのAgentアプリを使用。',
|
||||||
'Dify、n8n、Coze などを接続し、ボットのパイプラインを置き換えます。',
|
action: 'Agentアプリを選択',
|
||||||
ownModelTitle: '自分のモデルを使用',
|
selectTitle: 'Agentアプリを選択',
|
||||||
ownModelDescription:
|
selectDescription:
|
||||||
'現在の Local Agent パイプラインを開き、自分のモデルを設定します。',
|
'使用するAgentアプリプラットフォームを選択してください。',
|
||||||
moreFeaturesTitle: 'Agent に機能を追加',
|
},
|
||||||
moreFeaturesDescription:
|
llm: {
|
||||||
'ワークベンチを開き、ツールやナレッジなどの機能を追加します。',
|
title: '大規模モデルを直接使用',
|
||||||
runnerDescription: '外部 Agent の Runner を選択し、接続を設定します。',
|
description:
|
||||||
backToChoices: '選択肢に戻る',
|
'モデルプロバイダーを設定し、大規模モデルでボットを直接駆動。',
|
||||||
createExternal: '作成して関連付ける',
|
action: '大規模モデルを設定',
|
||||||
configurePipeline: 'パイプラインを設定',
|
},
|
||||||
openWorkbench: 'ワークベンチを開く',
|
|
||||||
},
|
},
|
||||||
spaceBanner: {
|
spaceBanner: {
|
||||||
message:
|
message:
|
||||||
'LangBot Spaceに接続して、無料トライアルモデルクレジットとゼロ設定の即時セットアップを入手!',
|
'LangBot Spaceに接続して、無料トライアルモデルクレジットとゼロ設定の即時セットアップを入手!',
|
||||||
action: 'Spaceで認証',
|
action: 'Spaceで認証',
|
||||||
},
|
},
|
||||||
|
provider: {
|
||||||
|
title: 'モデルプロバイダーを追加',
|
||||||
|
description:
|
||||||
|
'独自のモデルプロバイダーを追加します。APIキーを設定すると使用可能になります。',
|
||||||
|
scanTitle: '利用可能なモデルをスキャン',
|
||||||
|
scanDescription: 'プロバイダーから利用可能なLLMモデルをスキャン中です。',
|
||||||
|
scanning: 'モデルをスキャン中...',
|
||||||
|
noModelsFound:
|
||||||
|
'モデルが見つかりません。プロバイダー設定を確認してください。',
|
||||||
|
addSelected: '選択した{{count}}個のモデルを追加',
|
||||||
|
modelsAdded: '{{count}}個のモデルを追加しました',
|
||||||
|
modelsAddError: 'モデルの追加に失敗しました',
|
||||||
|
skipModelAdd: 'スキップ(後で追加)',
|
||||||
|
searchModels: 'モデルを検索...',
|
||||||
|
noMatch: '一致するモデルがありません',
|
||||||
|
orDivider: 'または',
|
||||||
|
manualModelPlaceholder: 'モデル名を入力して手動追加',
|
||||||
|
addManual: '追加',
|
||||||
|
saveAndNext: '保存して次へ',
|
||||||
|
alreadyAdded: '追加済み',
|
||||||
|
modelAlreadyExists: 'モデル「{{name}}」は既に存在します',
|
||||||
|
},
|
||||||
|
modelSource: {
|
||||||
|
title: 'モデルソースを選択',
|
||||||
|
description: 'AIエンジンにモデル機能を提供する方法を選択してください。',
|
||||||
|
space: {
|
||||||
|
title: 'LangBot サービス',
|
||||||
|
description:
|
||||||
|
'設定不要で利用可能。無料トライアルモデルクレジット付き。APIキー不要ですぐに使えます。',
|
||||||
|
action: 'LangBot サービスを使用',
|
||||||
|
},
|
||||||
|
custom: {
|
||||||
|
title: 'カスタムモデル',
|
||||||
|
description:
|
||||||
|
'お手持ちのモデルAPIキーを使用。OpenAI、Claude、Geminiなど主要モデルに対応。',
|
||||||
|
action: '独自のモデルを追加',
|
||||||
|
},
|
||||||
|
},
|
||||||
config: {
|
config: {
|
||||||
botInfo: 'ボット情報',
|
botInfo: 'ボット情報',
|
||||||
botNamePlaceholder: 'ボット名を入力',
|
botNamePlaceholder: 'ボット名を入力',
|
||||||
|
|||||||
@@ -1661,12 +1661,66 @@ const ruRU = {
|
|||||||
title: 'Выберите ИИ-движок',
|
title: 'Выберите ИИ-движок',
|
||||||
description:
|
description:
|
||||||
'Выберите ИИ-движок, который будет управлять интеллектом вашего бота.',
|
'Выберите ИИ-движок, который будет управлять интеллектом вашего бота.',
|
||||||
|
orchestrated: {
|
||||||
|
title: 'Использовать оркестрированные Agent-приложения',
|
||||||
|
description:
|
||||||
|
'Использовать готовые Agent-приложения из Dify, n8n, Coze и других.',
|
||||||
|
action: 'Выбрать Agent-приложение',
|
||||||
|
selectTitle: 'Выбрать Agent-приложение',
|
||||||
|
selectDescription:
|
||||||
|
'Выберите платформу Agent-приложения для использования.',
|
||||||
|
},
|
||||||
|
llm: {
|
||||||
|
title: 'Использовать LLM напрямую',
|
||||||
|
description:
|
||||||
|
'Настроить провайдера моделей и использовать LLM для управления ботом.',
|
||||||
|
action: 'Настроить LLM',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
spaceBanner: {
|
spaceBanner: {
|
||||||
message:
|
message:
|
||||||
'Подключитесь к LangBot Space для бесплатных пробных кредитов и мгновенной настройки!',
|
'Подключитесь к LangBot Space для бесплатных пробных кредитов и мгновенной настройки!',
|
||||||
action: 'Авторизация через Space',
|
action: 'Авторизация через Space',
|
||||||
},
|
},
|
||||||
|
provider: {
|
||||||
|
title: 'Добавить провайдера моделей',
|
||||||
|
description:
|
||||||
|
'Добавьте своего провайдера моделей. Настройте API-ключ для начала работы.',
|
||||||
|
scanTitle: 'Сканирование доступных моделей',
|
||||||
|
scanDescription: 'Сканирование LLM-моделей у вашего провайдера.',
|
||||||
|
scanning: 'Сканирование моделей...',
|
||||||
|
noModelsFound:
|
||||||
|
'Модели не найдены. Проверьте настройки провайдера.',
|
||||||
|
addSelected: 'Добавить {{count}} выбранную(ых)',
|
||||||
|
modelsAdded: 'Добавлено {{count}} модель(ей)',
|
||||||
|
modelsAddError: 'Ошибка добавления моделей',
|
||||||
|
skipModelAdd: 'Пропустить, добавить позже',
|
||||||
|
searchModels: 'Поиск моделей...',
|
||||||
|
noMatch: 'Нет подходящих моделей',
|
||||||
|
orDivider: 'или',
|
||||||
|
manualModelPlaceholder: 'Введите имя модели для ручного добавления',
|
||||||
|
addManual: 'Добавить',
|
||||||
|
saveAndNext: 'Сохранить и далее',
|
||||||
|
alreadyAdded: 'Добавлено',
|
||||||
|
modelAlreadyExists: 'Модель "{{name}}" уже существует',
|
||||||
|
},
|
||||||
|
modelSource: {
|
||||||
|
title: 'Выберите источник модели',
|
||||||
|
description:
|
||||||
|
'Выберите способ предоставления возможностей модели для вашего AI-движка.',
|
||||||
|
space: {
|
||||||
|
title: 'Сервис LangBot',
|
||||||
|
description:
|
||||||
|
'Готов к использованию без настройки, с бесплатными пробными кредитами. API-ключ не требуется.',
|
||||||
|
action: 'Использовать сервис LangBot',
|
||||||
|
},
|
||||||
|
custom: {
|
||||||
|
title: 'Пользовательская модель',
|
||||||
|
description:
|
||||||
|
'Используйте свой собственный API-ключ. Поддержка OpenAI, Claude, Gemini и других.',
|
||||||
|
action: 'Добавить свою модель',
|
||||||
|
},
|
||||||
|
},
|
||||||
config: {
|
config: {
|
||||||
botInfo: 'Информация о боте',
|
botInfo: 'Информация о боте',
|
||||||
botNamePlaceholder: 'Введите имя бота',
|
botNamePlaceholder: 'Введите имя бота',
|
||||||
|
|||||||
@@ -1626,12 +1626,64 @@ const thTH = {
|
|||||||
aiEngine: {
|
aiEngine: {
|
||||||
title: 'เลือกเครื่องมือ AI',
|
title: 'เลือกเครื่องมือ AI',
|
||||||
description: 'เลือกเครื่องมือ AI ที่จะขับเคลื่อนความฉลาดของ Bot',
|
description: 'เลือกเครื่องมือ AI ที่จะขับเคลื่อนความฉลาดของ Bot',
|
||||||
|
orchestrated: {
|
||||||
|
title: 'ใช้แอป Agent ที่จัดเตรียมไว้',
|
||||||
|
description:
|
||||||
|
'ใช้แอป Agent ที่สร้างไว้จาก Dify, n8n, Coze และอื่นๆ',
|
||||||
|
action: 'เลือกแอป Agent',
|
||||||
|
selectTitle: 'เลือกแอป Agent',
|
||||||
|
selectDescription: 'เลือกแพลตฟอร์มแอป Agent ที่ต้องการใช้',
|
||||||
|
},
|
||||||
|
llm: {
|
||||||
|
title: 'ใช้โมเดลโดยตรง',
|
||||||
|
description:
|
||||||
|
'กำหนดค่าผู้ให้บริการโมเดลและใช้โมเดลขับเคลื่อน Bot โดยตรง',
|
||||||
|
action: 'กำหนดค่าโมเดล',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
spaceBanner: {
|
spaceBanner: {
|
||||||
message:
|
message:
|
||||||
'เชื่อมต่อกับ LangBot Space เพื่อรับเครดิตทดลองใช้โมเดลฟรีและตั้งค่าทันทีโดยไม่ต้องกำหนดค่า!',
|
'เชื่อมต่อกับ LangBot Space เพื่อรับเครดิตทดลองใช้โมเดลฟรีและตั้งค่าทันทีโดยไม่ต้องกำหนดค่า!',
|
||||||
action: 'ยืนยันสิทธิ์กับ Space',
|
action: 'ยืนยันสิทธิ์กับ Space',
|
||||||
},
|
},
|
||||||
|
provider: {
|
||||||
|
title: 'เพิ่มผู้ให้บริการโมเดล',
|
||||||
|
description:
|
||||||
|
'เพิ่มผู้ให้บริการโมเดลของคุณเอง กำหนดค่า API key เพื่อเริ่มต้น',
|
||||||
|
scanTitle: 'สแกนโมเดลที่ใช้ได้',
|
||||||
|
scanDescription: 'กำลังสแกนโมเดล LLM จากผู้ให้บริการของคุณ',
|
||||||
|
scanning: 'กำลังสแกนโมเดล...',
|
||||||
|
noModelsFound:
|
||||||
|
'ไม่พบโมเดล กรุณาตรวจสอบการตั้งค่าผู้ให้บริการ',
|
||||||
|
addSelected: 'เพิ่ม {{count}} โมเดลที่เลือก',
|
||||||
|
modelsAdded: 'เพิ่ม {{count}} โมเดลแล้ว',
|
||||||
|
modelsAddError: 'เพิ่มโมเดลไม่สำเร็จ',
|
||||||
|
skipModelAdd: 'ข้าม เพิ่มทีหลัง',
|
||||||
|
searchModels: 'ค้นหาโมเดล...',
|
||||||
|
noMatch: 'ไม่พบโมเดลที่ตรงกัน',
|
||||||
|
orDivider: 'หรือ',
|
||||||
|
manualModelPlaceholder: 'กรอกชื่อโมเดลเพื่อเพิ่มด้วยตนเอง',
|
||||||
|
addManual: 'เพิ่ม',
|
||||||
|
saveAndNext: 'บันทึกและถัดไป',
|
||||||
|
alreadyAdded: 'เพิ่มแล้ว',
|
||||||
|
modelAlreadyExists: 'โมเดล "{{name}}" มีอยู่แล้ว',
|
||||||
|
},
|
||||||
|
modelSource: {
|
||||||
|
title: 'เลือกแหล่งโมเดล',
|
||||||
|
description: 'เลือกวิธีการให้ความสามารถของโมเดลสำหรับ AI engine ของคุณ',
|
||||||
|
space: {
|
||||||
|
title: 'บริการ LangBot',
|
||||||
|
description:
|
||||||
|
'พร้อมใช้งานทันทีไม่ต้องตั้งค่า พร้อมเครดิตทดลองใช้โมเดลฟรี ไม่ต้องใช้ API key',
|
||||||
|
action: 'ใช้บริการ LangBot',
|
||||||
|
},
|
||||||
|
custom: {
|
||||||
|
title: 'โมเดลกำหนดเอง',
|
||||||
|
description:
|
||||||
|
'ใช้ API key โมเดลของคุณเอง รองรับ OpenAI, Claude, Gemini และอื่นๆ',
|
||||||
|
action: 'เพิ่มโมเดลของฉัน',
|
||||||
|
},
|
||||||
|
},
|
||||||
config: {
|
config: {
|
||||||
botInfo: 'ข้อมูล Bot',
|
botInfo: 'ข้อมูล Bot',
|
||||||
botNamePlaceholder: 'กรอกชื่อ Bot',
|
botNamePlaceholder: 'กรอกชื่อ Bot',
|
||||||
|
|||||||
@@ -1652,12 +1652,64 @@ const viVN = {
|
|||||||
aiEngine: {
|
aiEngine: {
|
||||||
title: 'Chọn công cụ AI',
|
title: 'Chọn công cụ AI',
|
||||||
description: 'Chọn công cụ AI sẽ cung cấp trí tuệ cho Bot của bạn.',
|
description: 'Chọn công cụ AI sẽ cung cấp trí tuệ cho Bot của bạn.',
|
||||||
|
orchestrated: {
|
||||||
|
title: 'Sử dụng ứng dụng Agent đã được phối hợp',
|
||||||
|
description:
|
||||||
|
'Sử dụng các ứng dụng Agent đã được xây dựng từ Dify, n8n, Coze.',
|
||||||
|
action: 'Chọn ứng dụng Agent',
|
||||||
|
selectTitle: 'Chọn ứng dụng Agent',
|
||||||
|
selectDescription: 'Chọn nền tảng ứng dụng Agent bạn muốn sử dụng.',
|
||||||
|
},
|
||||||
|
llm: {
|
||||||
|
title: 'Sử dụng mô hình trực tiếp',
|
||||||
|
description:
|
||||||
|
'Cấu hình nhà cung cấp mô hình và sử dụng mô hình lớn để điều khiển Bot.',
|
||||||
|
action: 'Cấu hình mô hình',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
spaceBanner: {
|
spaceBanner: {
|
||||||
message:
|
message:
|
||||||
'Kết nối với LangBot Space để nhận tín dụng dùng thử mô hình miễn phí và thiết lập tức thì không cần cấu hình!',
|
'Kết nối với LangBot Space để nhận tín dụng dùng thử mô hình miễn phí và thiết lập tức thì không cần cấu hình!',
|
||||||
action: 'Ủy quyền với Space',
|
action: 'Ủy quyền với Space',
|
||||||
},
|
},
|
||||||
|
provider: {
|
||||||
|
title: 'Thêm nhà cung cấp mô hình',
|
||||||
|
description:
|
||||||
|
'Thêm nhà cung cấp mô hình của bạn. Cấu hình API key để bắt đầu.',
|
||||||
|
scanTitle: 'Quét mô hình khả dụng',
|
||||||
|
scanDescription: 'Đang quét mô hình LLM từ nhà cung cấp của bạn.',
|
||||||
|
scanning: 'Đang quét mô hình...',
|
||||||
|
noModelsFound:
|
||||||
|
'Không tìm thấy mô hình. Vui lòng kiểm tra cấu hình nhà cung cấp.',
|
||||||
|
addSelected: 'Thêm {{count}} mô hình đã chọn',
|
||||||
|
modelsAdded: 'Đã thêm {{count}} mô hình',
|
||||||
|
modelsAddError: 'Thêm mô hình thất bại',
|
||||||
|
skipModelAdd: 'Bỏ qua, thêm sau',
|
||||||
|
searchModels: 'Tìm kiếm mô hình...',
|
||||||
|
noMatch: 'Không tìm thấy mô hình phù hợp',
|
||||||
|
orDivider: 'hoặc',
|
||||||
|
manualModelPlaceholder: 'Nhập tên mô hình để thêm thủ công',
|
||||||
|
addManual: 'Thêm',
|
||||||
|
saveAndNext: 'Lưu & Tiếp theo',
|
||||||
|
alreadyAdded: 'Đã thêm',
|
||||||
|
modelAlreadyExists: 'Mô hình "{{name}}" đã tồn tại',
|
||||||
|
},
|
||||||
|
modelSource: {
|
||||||
|
title: 'Chọn nguồn mô hình',
|
||||||
|
description: 'Chọn cách cung cấp khả năng mô hình cho AI engine của bạn.',
|
||||||
|
space: {
|
||||||
|
title: 'Dịch vụ LangBot',
|
||||||
|
description:
|
||||||
|
'Sẵn sàng sử dụng không cần cấu hình, tặng tín dụng mô hình thử nghiệm miễn phí. Không cần API key.',
|
||||||
|
action: 'Sử dụng dịch vụ LangBot',
|
||||||
|
},
|
||||||
|
custom: {
|
||||||
|
title: 'Mô hình tùy chỉnh',
|
||||||
|
description:
|
||||||
|
'Sử dụng API key mô hình của riêng bạn. Hỗ trợ OpenAI, Claude, Gemini và nhiều hơn nữa.',
|
||||||
|
action: 'Thêm mô hình của tôi',
|
||||||
|
},
|
||||||
|
},
|
||||||
config: {
|
config: {
|
||||||
botInfo: 'Thông tin Bot',
|
botInfo: 'Thông tin Bot',
|
||||||
botNamePlaceholder: 'Nhập tên Bot',
|
botNamePlaceholder: 'Nhập tên Bot',
|
||||||
|
|||||||
@@ -1749,42 +1749,65 @@ const zhHans = {
|
|||||||
saveBot: '保存并启用',
|
saveBot: '保存并启用',
|
||||||
resaveBot: '重新保存配置',
|
resaveBot: '重新保存配置',
|
||||||
botSaved: '机器人配置已保存并启用,请查看日志确认连接正常。',
|
botSaved: '机器人配置已保存并启用,请查看日志确认连接正常。',
|
||||||
waitingForMessage: '机器人已启用。请在 IM 中向机器人发送一条消息以继续。',
|
|
||||||
messageReceived: '机器人已成功收到 IM 消息,可以进入下一步。',
|
|
||||||
pageBotTestPrompt:
|
|
||||||
'页面机器人已启用。点击右下角聊天气泡并发送一条消息,验证完整对话链路。',
|
|
||||||
webhookTestPrompt:
|
|
||||||
'回调地址已就绪。将它配置到外部平台,然后向机器人发送一条真实消息。',
|
|
||||||
httpTestPrompt: 'HTTP Bot 已启用。可直接发送一条真实入站消息验证连接。',
|
|
||||||
httpTestDefaultMessage: '你好,这是一条连接测试消息。',
|
|
||||||
sendHttpTest: '发送测试消息',
|
|
||||||
httpTestAccepted: '测试消息已被机器人接收,请稍候查看日志。',
|
|
||||||
httpTestMissingSecret: '请先填写入站签名密钥并重新保存。',
|
|
||||||
httpTestFailed: '测试消息发送失败:{{error}}',
|
|
||||||
logsTitle: '机器人日志',
|
logsTitle: '机器人日志',
|
||||||
logsDescription: '监控机器人活动,确认平台连接是否正常工作。',
|
logsDescription: '监控机器人活动,确认平台连接是否正常工作。',
|
||||||
},
|
},
|
||||||
aiEngine: {
|
aiEngine: {
|
||||||
title: '选择 AI 引擎',
|
title: '选择 AI 引擎',
|
||||||
description: '选择驱动机器人智能的 AI 引擎。',
|
description: '选择驱动机器人智能的 AI 引擎。',
|
||||||
optionalDescription: '这一步可选。选择接下来要如何完善当前 Agent。',
|
orchestrated: {
|
||||||
externalTitle: '接入外部平台 Agent',
|
title: '使用编排好的 Agent 应用',
|
||||||
externalDescription:
|
description: '使用 Dify、n8n、Coze 等平台编排好的 Agent 应用。',
|
||||||
'接入 Dify、n8n、Coze 等平台,并替换当前机器人的流水线。',
|
action: '选择 Agent 应用',
|
||||||
ownModelTitle: '改成使用自己的模型',
|
selectTitle: '选择 Agent 应用',
|
||||||
ownModelDescription: '进入当前 Local Agent 流水线,配置你自己的模型。',
|
selectDescription: '选择你要使用的 Agent 应用平台。',
|
||||||
moreFeaturesTitle: '给现在的 Agent 配置更多功能',
|
},
|
||||||
moreFeaturesDescription: '进入工作台,为 Agent 添加工具、知识库等能力。',
|
llm: {
|
||||||
runnerDescription: '选择外部 Agent 的 Runner 并完成连接配置。',
|
title: '直接使用大模型',
|
||||||
backToChoices: '返回选项',
|
description: '配置大模型供应商,直接使用大模型驱动机器人。',
|
||||||
createExternal: '创建并绑定',
|
action: '配置大模型',
|
||||||
configurePipeline: '配置流水线',
|
},
|
||||||
openWorkbench: '进入工作台',
|
|
||||||
},
|
},
|
||||||
spaceBanner: {
|
spaceBanner: {
|
||||||
message: '接入 LangBot Space,获取免费试用模型额度,零配置极速开箱!',
|
message: '接入 LangBot Space,获取免费试用模型额度,零配置极速开箱!',
|
||||||
action: '前往授权登录',
|
action: '前往授权登录',
|
||||||
},
|
},
|
||||||
|
provider: {
|
||||||
|
title: '添加模型供应商',
|
||||||
|
description: '添加你自己的模型供应商,配置 API Key 后即可使用。',
|
||||||
|
scanTitle: '扫描可用模型',
|
||||||
|
scanDescription: '正在从你的供应商中扫描可用的 LLM 模型。',
|
||||||
|
scanning: '正在扫描模型...',
|
||||||
|
noModelsFound: '未发现可用模型,请检查供应商配置。',
|
||||||
|
addSelected: '添加选中的 {{count}} 个模型',
|
||||||
|
modelsAdded: '已添加 {{count}} 个模型',
|
||||||
|
modelsAddError: '添加模型失败',
|
||||||
|
skipModelAdd: '跳过,稍后添加',
|
||||||
|
searchModels: '搜索模型...',
|
||||||
|
noMatch: '没有匹配的模型',
|
||||||
|
orDivider: '或',
|
||||||
|
manualModelPlaceholder: '输入模型名称手动添加',
|
||||||
|
addManual: '添加',
|
||||||
|
saveAndNext: '保存并下一步',
|
||||||
|
alreadyAdded: '已添加',
|
||||||
|
modelAlreadyExists: '模型 "{{name}}" 已存在',
|
||||||
|
},
|
||||||
|
modelSource: {
|
||||||
|
title: '选择模型来源',
|
||||||
|
description: '选择如何为你的 AI 引擎提供模型能力。',
|
||||||
|
space: {
|
||||||
|
title: 'LangBot 服务',
|
||||||
|
description:
|
||||||
|
'零配置即可使用,提供免费试用模型额度,开箱即用,无需自备 API Key。',
|
||||||
|
action: '使用 LangBot 服务',
|
||||||
|
},
|
||||||
|
custom: {
|
||||||
|
title: '自定义模型',
|
||||||
|
description:
|
||||||
|
'使用你自己的模型 API Key,支持 OpenAI、Claude、Gemini 等主流模型。',
|
||||||
|
action: '添加我自己的模型',
|
||||||
|
},
|
||||||
|
},
|
||||||
config: {
|
config: {
|
||||||
botInfo: '机器人信息',
|
botInfo: '机器人信息',
|
||||||
botNamePlaceholder: '请输入机器人名称',
|
botNamePlaceholder: '请输入机器人名称',
|
||||||
|
|||||||
@@ -1578,11 +1578,59 @@ const zhHant = {
|
|||||||
aiEngine: {
|
aiEngine: {
|
||||||
title: '選擇 AI 引擎',
|
title: '選擇 AI 引擎',
|
||||||
description: '選擇驅動機器人智慧的 AI 引擎。',
|
description: '選擇驅動機器人智慧的 AI 引擎。',
|
||||||
|
orchestrated: {
|
||||||
|
title: '使用編排好的 Agent 應用',
|
||||||
|
description: '使用 Dify、n8n、Coze 等平台編排好的 Agent 應用。',
|
||||||
|
action: '選擇 Agent 應用',
|
||||||
|
selectTitle: '選擇 Agent 應用',
|
||||||
|
selectDescription: '選擇你要使用的 Agent 應用平台。',
|
||||||
|
},
|
||||||
|
llm: {
|
||||||
|
title: '直接使用大模型',
|
||||||
|
description: '配置大模型供應商,直接使用大模型驅動機器人。',
|
||||||
|
action: '配置大模型',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
spaceBanner: {
|
spaceBanner: {
|
||||||
message: '接入 LangBot Space,取得免費試用模型額度,零配置極速開箱!',
|
message: '接入 LangBot Space,取得免費試用模型額度,零配置極速開箱!',
|
||||||
action: '前往授權登入',
|
action: '前往授權登入',
|
||||||
},
|
},
|
||||||
|
provider: {
|
||||||
|
title: '新增模型供應商',
|
||||||
|
description: '新增你自己的模型供應商,配置 API Key 後即可使用。',
|
||||||
|
scanTitle: '掃描可用模型',
|
||||||
|
scanDescription: '正在從你的供應商中掃描可用的 LLM 模型。',
|
||||||
|
scanning: '正在掃描模型...',
|
||||||
|
noModelsFound: '未發現可用模型,請檢查供應商配置。',
|
||||||
|
addSelected: '新增選取的 {{count}} 個模型',
|
||||||
|
modelsAdded: '已新增 {{count}} 個模型',
|
||||||
|
modelsAddError: '新增模型失敗',
|
||||||
|
skipModelAdd: '跳過,稍後新增',
|
||||||
|
searchModels: '搜尋模型...',
|
||||||
|
noMatch: '沒有符合的模型',
|
||||||
|
orDivider: '或',
|
||||||
|
manualModelPlaceholder: '輸入模型名稱手動新增',
|
||||||
|
addManual: '新增',
|
||||||
|
saveAndNext: '儲存並下一步',
|
||||||
|
alreadyAdded: '已新增',
|
||||||
|
modelAlreadyExists: '模型「{{name}}」已存在',
|
||||||
|
},
|
||||||
|
modelSource: {
|
||||||
|
title: '選擇模型來源',
|
||||||
|
description: '選擇如何為你的 AI 引擎提供模型能力。',
|
||||||
|
space: {
|
||||||
|
title: 'LangBot 服務',
|
||||||
|
description:
|
||||||
|
'零配置即可使用,提供免費試用模型額度,開箱即用,無需自備 API Key。',
|
||||||
|
action: '使用 LangBot 服務',
|
||||||
|
},
|
||||||
|
custom: {
|
||||||
|
title: '自訂模型',
|
||||||
|
description:
|
||||||
|
'使用你自己的模型 API Key,支援 OpenAI、Claude、Gemini 等主流模型。',
|
||||||
|
action: '新增我自己的模型',
|
||||||
|
},
|
||||||
|
},
|
||||||
config: {
|
config: {
|
||||||
botInfo: '機器人資訊',
|
botInfo: '機器人資訊',
|
||||||
botNamePlaceholder: '請輸入機器人名稱',
|
botNamePlaceholder: '請輸入機器人名稱',
|
||||||
|
|||||||
+18
-33
@@ -1,39 +1,24 @@
|
|||||||
import { defineConfig, loadEnv } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
import react from '@vitejs/plugin-react';
|
import react from '@vitejs/plugin-react';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
export default defineConfig(({ mode }) => {
|
export default defineConfig({
|
||||||
const env = loadEnv(mode, process.cwd(), '');
|
plugins: [react()],
|
||||||
const apiProxyTarget = env.VITE_API_PROXY_TARGET || 'http://127.0.0.1:5300';
|
resolve: {
|
||||||
|
alias: {
|
||||||
return {
|
'@': path.resolve(__dirname, './src'),
|
||||||
plugins: [react()],
|
},
|
||||||
resolve: {
|
},
|
||||||
alias: {
|
server: {
|
||||||
'@': path.resolve(__dirname, './src'),
|
port: 3000,
|
||||||
|
proxy: {
|
||||||
|
'/api': {
|
||||||
|
target: 'http://127.0.0.1:5300',
|
||||||
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
server: {
|
},
|
||||||
host: '0.0.0.0',
|
build: {
|
||||||
port: 3000,
|
outDir: 'dist',
|
||||||
proxy: {
|
},
|
||||||
'/api': {
|
|
||||||
target: apiProxyTarget,
|
|
||||||
changeOrigin: true,
|
|
||||||
ws: true,
|
|
||||||
},
|
|
||||||
'/mcp': {
|
|
||||||
target: apiProxyTarget,
|
|
||||||
changeOrigin: true,
|
|
||||||
},
|
|
||||||
'/bots': {
|
|
||||||
target: apiProxyTarget,
|
|
||||||
changeOrigin: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
build: {
|
|
||||||
outDir: 'dist',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user