@openviking/react 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.arco-design +21 -0
- package/README.md +27 -15
- package/dist/0~0.js +19 -0
- package/dist/28~0.js +15 -0
- package/dist/2~0.js +2270 -29
- package/dist/2~0.js.LICENSE.txt +23 -0
- package/dist/3c~0.js +2208 -0
- package/dist/3~0.js +1207 -1982
- package/dist/4~0.js +18 -0
- package/dist/9~0.js +43 -0
- package/dist/{1~0.js → ae~0.js} +11 -26
- package/dist/ark-message-list-view~0.js +530 -119
- package/dist/a~0.js +1300 -14
- package/dist/c7~0.js +38 -2
- package/dist/ck~0.js +23 -0
- package/dist/client/provider.d.ts +15 -9
- package/dist/client/types.d.ts +5 -5
- package/dist/client.js +2 -1
- package/dist/components/agent-connect/agent-connect-code-block.d.ts +14 -0
- package/dist/components/agent-connect/agent-connect-copy.d.ts +22 -33
- package/dist/components/agent-connect/agent-connect-design.d.ts +1936 -168
- package/dist/components/agent-connect/agent-connect-installer.d.ts +1 -0
- package/dist/components/agent-connect/agent-connect-instructions-view.d.ts +4 -6
- package/dist/components/agent-connect/agent-connect-instructions.d.ts +148 -0
- package/dist/components/agent-connect/agent-connect-markdown.d.ts +8 -2
- package/dist/components/agent-connect/agent-connect-mask.d.ts +10 -0
- package/dist/components/agent-connect/agent-connect.d.ts +1 -1
- package/dist/components/agent-connect/locales/en-US.d.ts +23 -0
- package/dist/components/agent-connect/locales/zh-CN.d.ts +3 -0
- package/dist/components/agent-connect/style.css +129 -3
- package/dist/components/agent-connect/types.d.ts +7 -4
- package/dist/components/agent-connect/use-agent-connect-copy.d.ts +6 -0
- package/dist/components/directory-tour/directory-tour.d.ts +3 -0
- package/dist/components/directory-tour/index.d.ts +3 -0
- package/dist/components/directory-tour/locales/en-US.d.ts +3 -0
- package/dist/components/directory-tour/locales/zh-CN.d.ts +3 -0
- package/dist/components/directory-tour/steps.d.ts +5 -0
- package/dist/components/directory-tour/style.css +237 -0
- package/dist/components/directory-tour/style.js +0 -0
- package/dist/components/directory-tour/types.d.ts +43 -0
- package/dist/components/directory-tour/use-tour-anchor.d.ts +5 -0
- package/dist/components/directory-tour/use-tour-position.d.ts +12 -0
- package/dist/components/directory-tour.js +40 -0
- package/dist/components/file-browser-entries/file-browser-entries.d.ts +5 -5
- package/dist/components/file-browser-entries/labels.d.ts +3 -0
- package/dist/components/file-browser-entries/locales/en-US.d.ts +6 -0
- package/dist/components/file-browser-entries/locales/zh-CN.d.ts +6 -0
- package/dist/components/file-browser-entries/style.css +866 -2
- package/dist/components/file-browser-entries/types.d.ts +34 -16
- package/dist/components/file-preview/file-preview-adapters.d.ts +2 -1
- package/dist/components/file-preview/file-preview-body.d.ts +2 -1
- package/dist/components/file-preview/file-preview-breadcrumb-menu.d.ts +2 -1
- package/dist/components/file-preview/file-preview-breadcrumb.d.ts +2 -1
- package/dist/components/file-preview/file-preview-directory.d.ts +2 -1
- package/dist/components/file-preview/file-preview-handle-adapters.d.ts +2 -1
- package/dist/components/file-preview/file-preview-header.d.ts +6 -2
- package/dist/components/file-preview/file-preview-image-frame.d.ts +5 -0
- package/dist/components/file-preview/file-preview-labels.d.ts +2 -14
- package/dist/components/file-preview/file-preview-level-tabs.d.ts +7 -0
- package/dist/components/file-preview/file-preview-markdown-images.d.ts +13 -0
- package/dist/components/file-preview/file-preview-panels.d.ts +5 -2
- package/dist/components/file-preview/file-preview-viewer.d.ts +2 -1
- package/dist/components/file-preview/file-preview.d.ts +0 -1
- package/dist/components/file-preview/index.d.ts +2 -1
- package/dist/components/file-preview/locales/en-US.d.ts +16 -0
- package/dist/components/file-preview/locales/zh-CN.d.ts +16 -0
- package/dist/components/file-preview/style.css +160 -2
- package/dist/components/file-preview/types.d.ts +34 -10
- package/dist/components/file-preview/use-file-preview-levels.d.ts +7 -0
- package/dist/components/file-preview/use-file-preview-view-state.d.ts +15 -0
- package/dist/components/file-preview.js +1 -1
- package/dist/components/file-tree/file-tree-info-labels.d.ts +0 -15
- package/dist/components/file-tree/file-tree-labels.d.ts +4 -0
- package/dist/components/file-tree/file-tree-row-shared.d.ts +2 -12
- package/dist/components/file-tree/file-tree-toolbar.d.ts +11 -0
- package/dist/components/file-tree/locales/en-US.d.ts +69 -0
- package/dist/components/file-tree/locales/zh-CN.d.ts +69 -0
- package/dist/components/file-tree/style.css +143 -15
- package/dist/components/file-tree/types.d.ts +38 -10
- package/dist/components/file-tree/use-file-tree-actions.d.ts +4 -1
- package/dist/components/scope-switcher/labels.d.ts +3 -0
- package/dist/components/scope-switcher/locales/en-US.d.ts +8 -0
- package/dist/components/scope-switcher/locales/zh-CN.d.ts +8 -0
- package/dist/components/scope-switcher/scope-panel.d.ts +1 -1
- package/dist/components/scope-switcher/scope-switcher.d.ts +2 -2
- package/dist/components/scope-switcher/style.css +14 -2
- package/dist/components/scope-switcher/types.d.ts +12 -6
- package/dist/components/style.css +10030 -6763
- package/dist/components/tui/locales/en-US.d.ts +35 -0
- package/dist/components/tui/locales/zh-CN.d.ts +35 -0
- package/dist/components/tui/style.css +310 -18
- package/dist/components/tui/tui-copy-button.d.ts +1 -1
- package/dist/components/tui/tui-empty.d.ts +25 -0
- package/dist/components/tui/tui-labels.d.ts +2 -2
- package/dist/components/tui/tui.d.ts +1 -1
- package/dist/components/tui/types.d.ts +35 -12
- package/dist/components/tui.js +1 -1
- package/dist/components/viking-bot/ark-adapter.d.ts +2 -0
- package/dist/components/viking-bot/ark-message-body.d.ts +1 -7
- package/dist/components/viking-bot/ark-message-list-view.d.ts +4 -1
- package/dist/components/viking-bot/ark-message-row.d.ts +3 -1
- package/dist/components/viking-bot/bot-popover.d.ts +9 -0
- package/dist/components/viking-bot/capabilities.d.ts +49 -0
- package/dist/components/viking-bot/composer-attachments.d.ts +13 -0
- package/dist/components/viking-bot/composer-controls.d.ts +10 -0
- package/dist/components/viking-bot/composer-footer.d.ts +17 -0
- package/dist/components/viking-bot/composer-references.d.ts +20 -0
- package/dist/components/viking-bot/composer-text.d.ts +10 -0
- package/dist/components/viking-bot/index.d.ts +3 -1
- package/dist/components/viking-bot/interaction/ask-human-fields.d.ts +1 -1
- package/dist/components/viking-bot/interaction/labels.d.ts +2 -1
- package/dist/components/viking-bot/interaction/locales/en-US.d.ts +17 -0
- package/dist/components/viking-bot/interaction/locales/zh-CN.d.ts +17 -0
- package/dist/components/viking-bot/interaction/types.d.ts +8 -3
- package/dist/components/viking-bot/interaction/viking-bot-interaction.d.ts +1 -1
- package/dist/components/viking-bot/labels.d.ts +2 -0
- package/dist/components/viking-bot/locales/en-US.d.ts +40 -0
- package/dist/components/viking-bot/locales/zh-CN.d.ts +40 -0
- package/dist/components/viking-bot/markdown-links.d.ts +27 -0
- package/dist/components/viking-bot/message-activity.d.ts +7 -0
- package/dist/components/viking-bot/message-code-block.d.ts +8 -0
- package/dist/components/viking-bot/message-footer.d.ts +8 -0
- package/dist/components/viking-bot/message-markdown.d.ts +9 -0
- package/dist/components/viking-bot/model.d.ts +37 -3
- package/dist/components/viking-bot/quick-input-tracker.d.ts +16 -0
- package/dist/components/viking-bot/quick-inputs.d.ts +6 -0
- package/dist/components/viking-bot/reference-picker.d.ts +16 -0
- package/dist/components/viking-bot/session-actions.d.ts +11 -0
- package/dist/components/viking-bot/style.css +1486 -48
- package/dist/components/viking-bot/tool-activity.d.ts +9 -0
- package/dist/components/viking-bot/tool-result-links.d.ts +6 -0
- package/dist/components/viking-bot/types.d.ts +20 -8
- package/dist/components/viking-bot/use-quick-input.d.ts +17 -0
- package/dist/components/viking-bot/viking-bot.d.ts +1 -6
- package/dist/components/viking-bot/welcome.d.ts +8 -0
- package/dist/components/viking-bot.js +1 -1
- package/dist/c~0.js +550 -69
- package/dist/e~0.js +335 -0
- package/dist/file-preview-viewer~0.js +90 -8
- package/dist/f~0.js +49 -51
- package/dist/h~0.js +5 -1
- package/dist/icons/console-icons.d.ts +12 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/viking-bot-icons.d.ts +6 -0
- package/dist/icons.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -1
- package/dist/k~0.js +1 -0
- package/dist/lg~0.js +155 -0
- package/dist/lk~0.js +40 -8
- package/dist/l~0.js +170 -181
- package/dist/modules/console/command-messages.d.ts +19 -0
- package/dist/modules/console/command-parser.d.ts +15 -0
- package/dist/modules/console/command-specs.d.ts +15 -0
- package/dist/modules/console/commands.d.ts +6 -0
- package/dist/modules/console/console-history.d.ts +10 -0
- package/dist/modules/console/console-toolbar.d.ts +18 -0
- package/dist/modules/console/console.d.ts +1 -3
- package/dist/modules/console/controller.d.ts +17 -0
- package/dist/modules/console/index.d.ts +2 -0
- package/dist/modules/console/labels.d.ts +61 -0
- package/dist/modules/console/locales/en-US.d.ts +49 -0
- package/dist/modules/console/locales/zh-CN.d.ts +3 -0
- package/dist/modules/console/localize-records.d.ts +11 -0
- package/dist/modules/console/results.d.ts +2 -0
- package/dist/modules/console/style.css +10905 -15
- package/dist/modules/console/types.d.ts +59 -80
- package/dist/modules/console/use-console.d.ts +3 -0
- package/dist/modules/console.js +1 -1
- package/dist/modules/file-browser/file-browser-detail.d.ts +2 -1
- package/dist/modules/file-browser/file-browser-labels.d.ts +11 -12
- package/dist/modules/file-browser/file-browser-toolbar.d.ts +3 -4
- package/dist/modules/file-browser/file-browser-tree-pane.d.ts +7 -5
- package/dist/modules/file-browser/file-browser.d.ts +1 -1
- package/dist/modules/file-browser/fs-read-directory.d.ts +2 -6
- package/dist/modules/file-browser/locales/en-US.d.ts +25 -0
- package/dist/modules/file-browser/locales/zh-CN.d.ts +25 -0
- package/dist/modules/file-browser/style.css +1695 -126
- package/dist/modules/file-browser/types.d.ts +38 -29
- package/dist/modules/file-browser/use-file-browser.d.ts +6 -1
- package/dist/modules/file-browser/use-fs-preview.d.ts +15 -1
- package/dist/modules/scope-cascade/labels.d.ts +6 -0
- package/dist/modules/scope-cascade/locales/en-US.d.ts +6 -0
- package/dist/modules/scope-cascade/locales/zh-CN.d.ts +3 -0
- package/dist/modules/scope-cascade/scope-cascade.d.ts +2 -2
- package/dist/modules/scope-cascade/style.css +14 -2
- package/dist/modules/scope-cascade/types.d.ts +3 -0
- package/dist/modules/style.css +15938 -3455
- package/dist/nx~0.js +15 -0
- package/dist/n~0.js +240 -83
- package/dist/o~0.js +10 -7
- package/dist/p~0.js +27 -0
- package/dist/rslib-runtime~0.js +42 -0
- package/dist/r~0.js +152 -0
- package/dist/shared/components/drawer/drawer.d.ts +13 -0
- package/dist/shared/components/drawer/index.d.ts +1 -0
- package/dist/shared/components/overlay/use-overlay-position.d.ts +2 -2
- package/dist/shared/components/tooltip/use-portal-theme.d.ts +3 -0
- package/dist/shared/locale-context.d.ts +8 -0
- package/dist/shared/locale.d.ts +6 -0
- package/dist/style.css +26339 -10577
- package/dist/u~0.js +397 -152
- package/dist/viking-bot-composer~0.js +436 -77
- package/dist/viking-bot-interaction~0.js +13 -11
- package/package.json +15 -4
- package/dist/30~0.js +0 -1332
- package/dist/components/tui/tui-labels-zh.d.ts +0 -2
- package/dist/modules/file-browser/tree-info-copy.d.ts +0 -15
- package/dist/modules/file-browser/tree-info-copy.zh-CN.d.ts +0 -15
package/dist/u~0.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { Children, createContext, isValidElement, useCallback, useContext, useId, useRef, useState } from "react";
|
|
3
|
+
import react_markdown from "react-markdown";
|
|
4
|
+
import rehype_raw from "rehype-raw";
|
|
5
|
+
import rehype_sanitize from "rehype-sanitize";
|
|
6
|
+
import remark_gfm from "remark-gfm";
|
|
7
|
+
import { resolveLocale } from "./nx~0.js";
|
|
8
|
+
import { checkreact } from "./0~0.js";
|
|
9
|
+
import { useLocale } from "./28~0.js";
|
|
3
10
|
const SvgCodexDetail = (props)=>/*#__PURE__*/ jsxs("svg", {
|
|
4
11
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5
12
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
@@ -49,40 +56,74 @@ const SvgCodexDetail = (props)=>/*#__PURE__*/ jsxs("svg", {
|
|
|
49
56
|
]
|
|
50
57
|
});
|
|
51
58
|
const codex_detailreact = SvgCodexDetail;
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
59
|
+
const messages = {
|
|
60
|
+
title: 'Connect Agent',
|
|
61
|
+
mainstream: 'Connect mainstream agents',
|
|
62
|
+
custom: 'Build your own agent',
|
|
63
|
+
integration: 'Integration',
|
|
64
|
+
instructions: 'Full instructions',
|
|
65
|
+
copy: 'Copy and send to Agent',
|
|
66
|
+
copyMarkdown: 'Copy as Markdown',
|
|
67
|
+
copyCode: 'Copy code',
|
|
68
|
+
showApiKey: 'Show API Key',
|
|
69
|
+
hideApiKey: 'Hide API Key',
|
|
70
|
+
copied: 'Copied',
|
|
71
|
+
failed: 'Copy failed. Please retry.',
|
|
72
|
+
notice: 'Connected agents can read content available to you in OpenViking. Overseas services may transfer data abroad.',
|
|
73
|
+
seeAgreement: ' See ',
|
|
74
|
+
agreement: 'Terms of Service',
|
|
75
|
+
apiKey: 'API Key',
|
|
76
|
+
overseas: 'Overseas',
|
|
77
|
+
hermesCustomIntro: '# Custom OpenViking server for Hermes\n\nConnect to the host-provided OpenViking server using the URL and API key in the setup steps below.\n\n',
|
|
78
|
+
hermesCustomStep: '3. Choose **Custom** and enter {{OPENVIKING_BASE_URL}} as the server URL.',
|
|
79
|
+
installerInstructions: (name, command)=>`Install the OpenViking memory plugin for ${name} and help me start using it. OpenViking is a context database for AI agents (https://github.com/volcengine/OpenViking); the command and link below are from its official docs.
|
|
80
|
+
|
|
81
|
+
1. Run the official installer. It needs network access and writes to my home directory; if your sandbox blocks that, ask me for approval:
|
|
82
|
+
|
|
83
|
+
${command}
|
|
84
|
+
|
|
85
|
+
2. Once it's installed, read the OpenViking onboarding guide and use it to walk me through setup. The guide has you ask me before choices like importing history or adding a working rule. docs.openviking.ai and docs.openviking.net are the same docs site; use whichever loads: https://docs.openviking.ai/agents/en/onboarding.md
|
|
86
|
+
|
|
87
|
+
The API key is one I created for myself in the OpenViking console; the installer stores it in ~/.openviking/ovcli.conf on this machine. Use it in the command as it is; there's no need to show it in your replies, and don't write it into any other file or rule. Talk to me in English.`
|
|
88
|
+
};
|
|
89
|
+
const en_US = messages;
|
|
90
|
+
const zh_CN_messages = {
|
|
91
|
+
title: '连接 Agent',
|
|
92
|
+
mainstream: '接入主流 Agent',
|
|
93
|
+
custom: '开发自己的 Agent',
|
|
94
|
+
integration: '接入',
|
|
95
|
+
instructions: '完整指令',
|
|
96
|
+
copy: '复制并发送给 Agent',
|
|
97
|
+
copyMarkdown: '复制为 Markdown',
|
|
98
|
+
copyCode: '复制代码',
|
|
99
|
+
showApiKey: '显示 API Key',
|
|
100
|
+
hideApiKey: '隐藏 API Key',
|
|
101
|
+
copied: '已复制',
|
|
102
|
+
failed: '复制失败,请重试',
|
|
103
|
+
notice: '接入后 Agent 能读到你在 OpenViking 里能看到的内容,若接入境外服务数据有可能传到境外。',
|
|
104
|
+
seeAgreement: '详见',
|
|
105
|
+
agreement: '《用户协议》',
|
|
106
|
+
apiKey: 'API Key',
|
|
107
|
+
overseas: '境外',
|
|
108
|
+
hermesCustomIntro: '# 为 Hermes 配置自定义 OpenViking 服务\n\n连接调用方指定的 OpenViking 服务,使用以下步骤填写服务地址和 API Key。\n\n',
|
|
109
|
+
hermesCustomStep: '3. 选择 **Custom**,服务地址填写 {{OPENVIKING_BASE_URL}}。',
|
|
110
|
+
installerInstructions: (name, command)=>`帮我为 ${name} 安装 OpenViking 记忆插件,并带我开始使用。OpenViking 是为 Agent 提供的上下文数据库(https://github.com/volcengine/OpenViking),下面的命令和链接来自它的官方文档。
|
|
111
|
+
|
|
112
|
+
1. 运行官方安装器。它需要联网并写入我的主目录,如果被你的沙箱拦住,请向我申请批准:
|
|
113
|
+
|
|
114
|
+
${command}
|
|
115
|
+
|
|
116
|
+
2. 装好后读 OpenViking 的接入引导,按它带我完成设置。导入历史、写协作规则这类选择,引导会让你先问我。docs.openviking.ai 和 docs.openviking.net 是同一个文档站,哪个打得开用哪个:https://docs.openviking.ai/agents/zh/onboarding.md
|
|
117
|
+
|
|
118
|
+
API key 是我在 OpenViking 控制台给自己生成的,安装器会把它存到本机的 ~/.openviking/ovcli.conf。命令里原样使用就行,回复里不用再显示它,也不要写进别的文件或规则。全程用中文和我交流。`
|
|
85
119
|
};
|
|
120
|
+
const zh_CN = zh_CN_messages;
|
|
121
|
+
function resolveAgentConnectLabels(locale) {
|
|
122
|
+
return resolveLocale({
|
|
123
|
+
'en-US': en_US,
|
|
124
|
+
'zh-CN': zh_CN
|
|
125
|
+
}, locale);
|
|
126
|
+
}
|
|
86
127
|
const content_zh = {
|
|
87
128
|
codex: {
|
|
88
129
|
name: 'Codex',
|
|
@@ -461,31 +502,22 @@ const INSTALLER_HARNESSES = {
|
|
|
461
502
|
function shellArgument(value) {
|
|
462
503
|
return `'${value.replace(/'/g, "'\"'\"'")}'`;
|
|
463
504
|
}
|
|
505
|
+
function getInstallerCommand(harness, locale, apiKey, baseUrl) {
|
|
506
|
+
return `curl -fsSL https://openviking.ai/install | bash -s -- --yes --lang ${'zh-CN' === locale ? 'zh' : 'en'} --harness ${harness},cli --url ${shellArgument(baseUrl)} --api-key ${shellArgument(apiKey)}`;
|
|
507
|
+
}
|
|
464
508
|
function getInstallerInstructions(name, harness, locale, apiKey, baseUrl) {
|
|
465
|
-
const command =
|
|
466
|
-
return
|
|
467
|
-
|
|
468
|
-
1. 运行官方安装器。它需要联网并写入我的主目录,如果被你的沙箱拦住,请向我申请批准:
|
|
469
|
-
|
|
470
|
-
${command}
|
|
471
|
-
|
|
472
|
-
2. 装好后读 OpenViking 的接入引导,按它带我完成设置。导入历史、写协作规则这类选择,引导会让你先问我。docs.openviking.ai 和 docs.openviking.net 是同一个文档站,哪个打得开用哪个:https://docs.openviking.ai/agents/zh/onboarding.md
|
|
473
|
-
|
|
474
|
-
API key 是我在 OpenViking 控制台给自己生成的,安装器会把它存到本机的 ~/.openviking/ovcli.conf。命令里原样使用就行,回复里不用再显示它,也不要写进别的文件或规则。全程用中文和我交流。` : `Install the OpenViking memory plugin for ${name} and help me start using it. OpenViking is a context database for AI agents (https://github.com/volcengine/OpenViking); the command and link below are from its official docs.
|
|
475
|
-
|
|
476
|
-
1. Run the official installer. It needs network access and writes to my home directory; if your sandbox blocks that, ask me for approval:
|
|
477
|
-
|
|
478
|
-
${command}
|
|
479
|
-
|
|
480
|
-
2. Once it's installed, read the OpenViking onboarding guide and use it to walk me through setup. The guide has you ask me before choices like importing history or adding a working rule. docs.openviking.ai and docs.openviking.net are the same docs site; use whichever loads: https://docs.openviking.ai/agents/en/onboarding.md
|
|
481
|
-
|
|
482
|
-
The API key is one I created for myself in the OpenViking console; the installer stores it in ~/.openviking/ovcli.conf on this machine. Use it in the command as it is; there's no need to show it in your replies, and don't write it into any other file or rule. Talk to me in English.`;
|
|
509
|
+
const command = getInstallerCommand(harness, locale, apiKey, baseUrl);
|
|
510
|
+
return resolveAgentConnectLabels(locale).installerInstructions(name, command);
|
|
483
511
|
}
|
|
484
512
|
const DEFAULT_BASE_URL = 'https://api.vikingdb.cn-beijing.volces.com/openviking';
|
|
485
513
|
function getAgentConnectContent(locale) {
|
|
486
|
-
return
|
|
514
|
+
return resolveLocale({
|
|
515
|
+
'en-US': content_en,
|
|
516
|
+
'zh-CN': content_zh
|
|
517
|
+
}, locale);
|
|
487
518
|
}
|
|
488
519
|
function getAgentConnectInstructions(id, locale, apiKey, baseUrl, guideId) {
|
|
520
|
+
const text = resolveAgentConnectLabels(locale);
|
|
489
521
|
const content = getAgentConnectContent(locale)[id];
|
|
490
522
|
const harness = INSTALLER_HARNESSES[id];
|
|
491
523
|
if (harness) {
|
|
@@ -493,17 +525,27 @@ function getAgentConnectInstructions(id, locale, apiKey, baseUrl, guideId) {
|
|
|
493
525
|
return {
|
|
494
526
|
fixed: true,
|
|
495
527
|
display: instructions('••••••••'),
|
|
496
|
-
copy: instructions(apiKey)
|
|
528
|
+
copy: instructions(apiKey),
|
|
529
|
+
command: {
|
|
530
|
+
display: getInstallerCommand(harness, locale, '••••••••', baseUrl),
|
|
531
|
+
copy: getInstallerCommand(harness, locale, apiKey, baseUrl)
|
|
532
|
+
}
|
|
497
533
|
};
|
|
498
534
|
}
|
|
499
535
|
const guide = content.guides.find((item)=>item.id === guideId);
|
|
500
536
|
let template = guide?.markdown ?? content.markdown;
|
|
501
537
|
if ('hermes' === id && baseUrl.replace(/\/+$/, '') !== DEFAULT_BASE_URL) {
|
|
502
|
-
template = template.replace(/^[\s\S]*?(?=^## )/m, ()=>
|
|
503
|
-
template = template.replace(/^3\. (?:选择|Choose) \*\*OpenViking Service \(VolcEngine Cloud\)\*\*[。.][ \t]*$/m, ()=>
|
|
538
|
+
template = template.replace(/^[\s\S]*?(?=^## )/m, ()=>text.hermesCustomIntro);
|
|
539
|
+
template = template.replace(/^3\. (?:选择|Choose) \*\*OpenViking Service \(VolcEngine Cloud\)\*\*[。.][ \t]*$/m, ()=>text.hermesCustomStep);
|
|
504
540
|
}
|
|
505
541
|
if (!/\{\{OPENVIKING_API_KEY/.test(template)) template += '\n\nBase URL: {{OPENVIKING_BASE_URL}}\n\nAPI Key:\n\n{{OPENVIKING_API_KEY_BLOCK}}';
|
|
506
542
|
const pathBaseUrl = baseUrl.replace(/\/+$/, '');
|
|
543
|
+
let keyToken = 'OV_API_KEY_TOKEN';
|
|
544
|
+
while([
|
|
545
|
+
template,
|
|
546
|
+
baseUrl,
|
|
547
|
+
apiKey
|
|
548
|
+
].some((value)=>value.includes(keyToken)))keyToken += '_';
|
|
507
549
|
function hydrate(key) {
|
|
508
550
|
return template.replace(/\{\{OPENVIKING_BASE_URL\}\}|\{\{OPENVIKING_API_KEY_BLOCK\}\}|\{\{OPENVIKING_API_KEY\}\}|<API_KEY>|https:\/\/api\.vikingdb\.cn-beijing\.volces\.com\/openviking/g, (token, offset)=>{
|
|
509
551
|
if ('{{OPENVIKING_API_KEY_BLOCK}}' === token) {
|
|
@@ -517,7 +559,9 @@ function getAgentConnectInstructions(id, locale, apiKey, baseUrl, guideId) {
|
|
|
517
559
|
return {
|
|
518
560
|
fixed: false,
|
|
519
561
|
display: hydrate('••••••••'),
|
|
520
|
-
copy: hydrate(apiKey)
|
|
562
|
+
copy: hydrate(apiKey),
|
|
563
|
+
markdown: hydrate(keyToken),
|
|
564
|
+
keyToken
|
|
521
565
|
};
|
|
522
566
|
}
|
|
523
567
|
const SvgCopy = (props)=>/*#__PURE__*/ jsxs("svg", {
|
|
@@ -533,7 +577,7 @@ const SvgCopy = (props)=>/*#__PURE__*/ jsxs("svg", {
|
|
|
533
577
|
children: /*#__PURE__*/ jsx("g", {
|
|
534
578
|
clipPath: "url(#copy_svg__b)",
|
|
535
579
|
children: /*#__PURE__*/ jsx("path", {
|
|
536
|
-
fill: "
|
|
580
|
+
fill: "currentColor",
|
|
537
581
|
fillRule: "evenodd",
|
|
538
582
|
d: "M10.667 4c.368 0 .666.299.666.667v9.407c0 .328-.278.593-.622.593H2.622c-.343 0-.622-.265-.622-.593V4.593C2 4.265 2.279 4 2.622 4zM10 5.334H3.333v8H10zm3.333-4c.368 0 .667.298.667.666v8.334c0 .184-.15.333-.333.333H13a.333.333 0 0 1-.333-.333V2.667H6.333A.333.333 0 0 1 6 2.334v-.667c0-.184.15-.334.333-.334z",
|
|
539
583
|
clipRule: "evenodd"
|
|
@@ -561,102 +605,54 @@ const SvgCopy = (props)=>/*#__PURE__*/ jsxs("svg", {
|
|
|
561
605
|
]
|
|
562
606
|
});
|
|
563
607
|
const copyreact = SvgCopy;
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
}, index);
|
|
579
|
-
return /*#__PURE__*/ jsx(external_react_Fragment, {
|
|
580
|
-
children: part
|
|
581
|
-
}, index);
|
|
582
|
-
});
|
|
583
|
-
}
|
|
584
|
-
function Prose({ text }) {
|
|
585
|
-
const lines = text.split('\n').filter((line)=>!/^\s*!\[/.test(line));
|
|
586
|
-
const blocks = [];
|
|
587
|
-
let current = '';
|
|
588
|
-
for (const line of lines)if (line.trim()) if (/^#{1,6}\s/.test(line)) {
|
|
589
|
-
if (current) blocks.push(current);
|
|
590
|
-
blocks.push(line);
|
|
591
|
-
current = '';
|
|
592
|
-
} else current += `${current ? '\n' : ''}${line}`;
|
|
593
|
-
else {
|
|
594
|
-
if (current) blocks.push(current);
|
|
595
|
-
current = '';
|
|
596
|
-
}
|
|
597
|
-
if (current) blocks.push(current);
|
|
598
|
-
return blocks.map((block, index)=>{
|
|
599
|
-
if (/^#{1,6}\s/.test(block)) return /*#__PURE__*/ jsx("h5", {
|
|
600
|
-
children: /*#__PURE__*/ jsx(Inline, {
|
|
601
|
-
text: block.replace(/^#{1,6}\s/, '')
|
|
602
|
-
})
|
|
603
|
-
}, index);
|
|
604
|
-
if (block.startsWith('|')) {
|
|
605
|
-
const rows = block.split('\n').filter((row)=>!/^\|[\s:|-]+\|$/.test(row));
|
|
606
|
-
return /*#__PURE__*/ jsx("table", {
|
|
607
|
-
children: /*#__PURE__*/ jsx("tbody", {
|
|
608
|
-
children: rows.map((row, rowIndex)=>/*#__PURE__*/ jsx("tr", {
|
|
609
|
-
children: row.split('|').slice(1, -1).map((cell, column)=>0 === rowIndex ? /*#__PURE__*/ jsx("th", {
|
|
610
|
-
children: /*#__PURE__*/ jsx(Inline, {
|
|
611
|
-
text: cell.trim()
|
|
612
|
-
})
|
|
613
|
-
}, column) : /*#__PURE__*/ jsx("td", {
|
|
614
|
-
children: /*#__PURE__*/ jsx(Inline, {
|
|
615
|
-
text: cell.trim()
|
|
616
|
-
})
|
|
617
|
-
}, column))
|
|
618
|
-
}, rowIndex))
|
|
619
|
-
})
|
|
620
|
-
}, index);
|
|
621
|
-
}
|
|
622
|
-
return /*#__PURE__*/ jsx("p", {
|
|
623
|
-
children: /*#__PURE__*/ jsx(Inline, {
|
|
624
|
-
text: block
|
|
608
|
+
const SvgEye = (props)=>/*#__PURE__*/ jsxs("svg", {
|
|
609
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
610
|
+
fill: "none",
|
|
611
|
+
stroke: "currentColor",
|
|
612
|
+
strokeWidth: 4,
|
|
613
|
+
viewBox: "0 0 48 48",
|
|
614
|
+
...props,
|
|
615
|
+
children: [
|
|
616
|
+
/*#__PURE__*/ jsx("path", {
|
|
617
|
+
d: "M24 37q9.94 0 18-13-8.06-13-18-13T6 24q8.06 13 18 13Z",
|
|
618
|
+
clipRule: "evenodd"
|
|
619
|
+
}),
|
|
620
|
+
/*#__PURE__*/ jsx("path", {
|
|
621
|
+
d: "M29 24a5 5 0 1 1-10 0 5 5 0 0 1 10 0Z"
|
|
625
622
|
})
|
|
626
|
-
|
|
623
|
+
]
|
|
627
624
|
});
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
625
|
+
const eyereact = SvgEye;
|
|
626
|
+
const SvgEyeInvisible = (props)=>/*#__PURE__*/ jsxs("svg", {
|
|
627
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
628
|
+
fill: "none",
|
|
629
|
+
stroke: "currentColor",
|
|
630
|
+
strokeWidth: 4,
|
|
631
|
+
viewBox: "0 0 48 48",
|
|
632
|
+
...props,
|
|
633
|
+
children: [
|
|
634
|
+
/*#__PURE__*/ jsx("path", {
|
|
635
|
+
d: "M14 14.5c-2.69 2-5.415 5.33-8 9.5q8.06 13 18 13 4.987 0 9.5-3.271M17.463 12.5C19 11 21.75 11 24 11q9.94 0 18 13-2.649 4.272-5.5 7.14"
|
|
636
|
+
}),
|
|
637
|
+
/*#__PURE__*/ jsx("path", {
|
|
638
|
+
d: "M29 24a5 5 0 1 1-10 0 5 5 0 0 1 10 0ZM6.852 7.103l34.294 34.294"
|
|
639
|
+
})
|
|
640
|
+
]
|
|
642
641
|
});
|
|
643
|
-
|
|
644
|
-
function
|
|
642
|
+
const eye_invisiblereact = SvgEyeInvisible;
|
|
643
|
+
function useAgentConnectCopy(text, onCopy) {
|
|
645
644
|
const [status, setStatus] = useState('idle');
|
|
646
645
|
const pending = useRef(false);
|
|
647
646
|
const mounted = useRef(false);
|
|
648
647
|
const setRoot = useCallback((node)=>{
|
|
649
648
|
mounted.current = null !== node;
|
|
650
649
|
}, []);
|
|
651
|
-
|
|
652
|
-
const message = 'copied' === status ? labels.copied : 'failed' === status ? labels.failed : '';
|
|
653
|
-
const copyLabel = instructions.fixed ? labels.copy : labels.copyMarkdown;
|
|
654
|
-
async function handleCopy() {
|
|
650
|
+
async function copy() {
|
|
655
651
|
if (pending.current) return;
|
|
656
652
|
pending.current = true;
|
|
657
653
|
setStatus('pending');
|
|
658
654
|
try {
|
|
659
|
-
await navigator.clipboard.writeText(
|
|
655
|
+
await navigator.clipboard.writeText(text);
|
|
660
656
|
} catch {
|
|
661
657
|
if (mounted.current) setStatus('failed');
|
|
662
658
|
return;
|
|
@@ -665,8 +661,241 @@ function AgentConnectInstructionsView({ instructions, locale, agreementUrl, onCo
|
|
|
665
661
|
}
|
|
666
662
|
if (!mounted.current) return;
|
|
667
663
|
setStatus('copied');
|
|
668
|
-
onCopy?.(
|
|
664
|
+
onCopy?.(text);
|
|
669
665
|
}
|
|
666
|
+
return {
|
|
667
|
+
status,
|
|
668
|
+
setRoot,
|
|
669
|
+
copy
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
function AgentConnectCodeBlock({ display, copyText, language, locale, visibleBlockId, onReveal, onCopy }) {
|
|
673
|
+
const id = useId();
|
|
674
|
+
const revealed = visibleBlockId === id;
|
|
675
|
+
const hasKey = display !== copyText;
|
|
676
|
+
const labels = resolveAgentConnectLabels(locale);
|
|
677
|
+
const { status, setRoot, copy } = useAgentConnectCopy(copyText, onCopy);
|
|
678
|
+
const revealLabel = revealed ? labels.hideApiKey : labels.showApiKey;
|
|
679
|
+
const copyLabel = 'copied' === status ? labels.copied : labels.copyCode;
|
|
680
|
+
const RevealIcon = revealed ? eye_invisiblereact : eyereact;
|
|
681
|
+
const ClipboardIcon = 'copied' === status ? checkreact : copyreact;
|
|
682
|
+
const feedback = 'failed' === status ? labels.failed : 'copied' === status ? labels.copied : '';
|
|
683
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
684
|
+
ref: setRoot,
|
|
685
|
+
className: "ov-agent-connect__code-block",
|
|
686
|
+
children: [
|
|
687
|
+
/*#__PURE__*/ jsxs("div", {
|
|
688
|
+
className: "ov-agent-connect__code-header",
|
|
689
|
+
children: [
|
|
690
|
+
/*#__PURE__*/ jsx("span", {
|
|
691
|
+
children: language || 'text'
|
|
692
|
+
}),
|
|
693
|
+
/*#__PURE__*/ jsxs("div", {
|
|
694
|
+
className: "ov-agent-connect__code-actions",
|
|
695
|
+
children: [
|
|
696
|
+
hasKey ? /*#__PURE__*/ jsx("button", {
|
|
697
|
+
type: "button",
|
|
698
|
+
"aria-pressed": revealed,
|
|
699
|
+
"aria-label": revealLabel,
|
|
700
|
+
title: revealLabel,
|
|
701
|
+
onClick: ()=>onReveal(revealed ? null : id),
|
|
702
|
+
children: /*#__PURE__*/ jsx(RevealIcon, {
|
|
703
|
+
"aria-hidden": "true"
|
|
704
|
+
})
|
|
705
|
+
}) : null,
|
|
706
|
+
/*#__PURE__*/ jsx("button", {
|
|
707
|
+
type: "button",
|
|
708
|
+
disabled: 'pending' === status,
|
|
709
|
+
"aria-label": copyLabel,
|
|
710
|
+
title: copyLabel,
|
|
711
|
+
onClick: ()=>void copy(),
|
|
712
|
+
children: /*#__PURE__*/ jsx(ClipboardIcon, {
|
|
713
|
+
"aria-hidden": "true"
|
|
714
|
+
})
|
|
715
|
+
})
|
|
716
|
+
]
|
|
717
|
+
})
|
|
718
|
+
]
|
|
719
|
+
}),
|
|
720
|
+
/*#__PURE__*/ jsx("pre", {
|
|
721
|
+
children: /*#__PURE__*/ jsx("code", {
|
|
722
|
+
children: revealed ? copyText : display
|
|
723
|
+
})
|
|
724
|
+
}),
|
|
725
|
+
/*#__PURE__*/ jsx("span", {
|
|
726
|
+
className: 'failed' === status ? 'ov-agent-connect__feedback ov-agent-connect__feedback--error' : 'ov-agent-connect__code-feedback',
|
|
727
|
+
role: "status",
|
|
728
|
+
"aria-live": "polite",
|
|
729
|
+
children: feedback
|
|
730
|
+
})
|
|
731
|
+
]
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
function remarkMaskApiKey({ keyToken }) {
|
|
735
|
+
return (tree)=>{
|
|
736
|
+
function mask(node) {
|
|
737
|
+
if (('text' === node.type || 'inlineCode' === node.type || 'html' === node.type) && node.value) node.value = node.value.split(keyToken).join('••••••••');
|
|
738
|
+
node.children?.forEach(mask);
|
|
739
|
+
}
|
|
740
|
+
mask(tree);
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
const markdownHtmlSchema = {
|
|
744
|
+
attributes: {
|
|
745
|
+
a: [
|
|
746
|
+
'href',
|
|
747
|
+
'title'
|
|
748
|
+
],
|
|
749
|
+
code: [
|
|
750
|
+
[
|
|
751
|
+
'className',
|
|
752
|
+
/^language-[\w-]+$/
|
|
753
|
+
]
|
|
754
|
+
],
|
|
755
|
+
details: [
|
|
756
|
+
'open'
|
|
757
|
+
],
|
|
758
|
+
td: [
|
|
759
|
+
'align',
|
|
760
|
+
'colSpan',
|
|
761
|
+
'rowSpan'
|
|
762
|
+
],
|
|
763
|
+
th: [
|
|
764
|
+
'align',
|
|
765
|
+
'colSpan',
|
|
766
|
+
'rowSpan'
|
|
767
|
+
]
|
|
768
|
+
},
|
|
769
|
+
protocols: {
|
|
770
|
+
href: [
|
|
771
|
+
'http',
|
|
772
|
+
'https',
|
|
773
|
+
'mailto'
|
|
774
|
+
]
|
|
775
|
+
},
|
|
776
|
+
tagNames: [
|
|
777
|
+
'a',
|
|
778
|
+
'b',
|
|
779
|
+
'blockquote',
|
|
780
|
+
'br',
|
|
781
|
+
'code',
|
|
782
|
+
'del',
|
|
783
|
+
'details',
|
|
784
|
+
'em',
|
|
785
|
+
'h1',
|
|
786
|
+
'h2',
|
|
787
|
+
'h3',
|
|
788
|
+
'h4',
|
|
789
|
+
'h5',
|
|
790
|
+
'h6',
|
|
791
|
+
'hr',
|
|
792
|
+
'li',
|
|
793
|
+
'ol',
|
|
794
|
+
'p',
|
|
795
|
+
'pre',
|
|
796
|
+
's',
|
|
797
|
+
'strong',
|
|
798
|
+
'summary',
|
|
799
|
+
'table',
|
|
800
|
+
'tbody',
|
|
801
|
+
'td',
|
|
802
|
+
'th',
|
|
803
|
+
'thead',
|
|
804
|
+
'tr',
|
|
805
|
+
'ul'
|
|
806
|
+
]
|
|
807
|
+
};
|
|
808
|
+
const components = {
|
|
809
|
+
h1: ({ children })=>/*#__PURE__*/ jsx("h5", {
|
|
810
|
+
children: children
|
|
811
|
+
}),
|
|
812
|
+
h2: ({ children })=>/*#__PURE__*/ jsx("h5", {
|
|
813
|
+
children: children
|
|
814
|
+
}),
|
|
815
|
+
h3: ({ children })=>/*#__PURE__*/ jsx("h5", {
|
|
816
|
+
children: children
|
|
817
|
+
}),
|
|
818
|
+
h4: ({ children })=>/*#__PURE__*/ jsx("h5", {
|
|
819
|
+
children: children
|
|
820
|
+
}),
|
|
821
|
+
h5: ({ children })=>/*#__PURE__*/ jsx("h5", {
|
|
822
|
+
children: children
|
|
823
|
+
}),
|
|
824
|
+
h6: ({ children })=>/*#__PURE__*/ jsx("h5", {
|
|
825
|
+
children: children
|
|
826
|
+
}),
|
|
827
|
+
a: ({ children, href, title })=>/*#__PURE__*/ jsx("a", {
|
|
828
|
+
href: href,
|
|
829
|
+
title: title,
|
|
830
|
+
target: "_blank",
|
|
831
|
+
rel: "noopener noreferrer",
|
|
832
|
+
children: children
|
|
833
|
+
}),
|
|
834
|
+
pre: MarkdownCodeBlock
|
|
835
|
+
};
|
|
836
|
+
const codeBlockContext = /*#__PURE__*/ createContext(null);
|
|
837
|
+
function MarkdownCodeBlock({ children }) {
|
|
838
|
+
const context = useContext(codeBlockContext);
|
|
839
|
+
const child = Children.toArray(children)[0];
|
|
840
|
+
if (!context || !/*#__PURE__*/ isValidElement(child) || 'string' != typeof child.props.children) return /*#__PURE__*/ jsx("pre", {
|
|
841
|
+
children: children
|
|
842
|
+
});
|
|
843
|
+
const { keyToken, apiKey, ...controls } = context;
|
|
844
|
+
const code = child.props.children.replace(/\n$/, '');
|
|
845
|
+
return /*#__PURE__*/ jsx(AgentConnectCodeBlock, {
|
|
846
|
+
...controls,
|
|
847
|
+
language: child.props.className?.replace(/^language-/, ''),
|
|
848
|
+
display: code.split(keyToken).join('••••••••'),
|
|
849
|
+
copyText: code.split(keyToken).join(apiKey)
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
function AgentConnectMarkdown({ text, ...context }) {
|
|
853
|
+
return /*#__PURE__*/ jsx("div", {
|
|
854
|
+
className: "ov-agent-connect__markdown",
|
|
855
|
+
children: /*#__PURE__*/ jsx(codeBlockContext.Provider, {
|
|
856
|
+
value: context,
|
|
857
|
+
children: /*#__PURE__*/ jsx(react_markdown, {
|
|
858
|
+
remarkPlugins: [
|
|
859
|
+
[
|
|
860
|
+
remark_gfm,
|
|
861
|
+
{
|
|
862
|
+
singleTilde: false
|
|
863
|
+
}
|
|
864
|
+
],
|
|
865
|
+
[
|
|
866
|
+
remarkMaskApiKey,
|
|
867
|
+
{
|
|
868
|
+
keyToken: context.keyToken
|
|
869
|
+
}
|
|
870
|
+
]
|
|
871
|
+
],
|
|
872
|
+
rehypePlugins: [
|
|
873
|
+
rehype_raw,
|
|
874
|
+
[
|
|
875
|
+
rehype_sanitize,
|
|
876
|
+
markdownHtmlSchema
|
|
877
|
+
]
|
|
878
|
+
],
|
|
879
|
+
components: components,
|
|
880
|
+
children: text
|
|
881
|
+
})
|
|
882
|
+
})
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
function AgentConnectInstructionsView({ instructions, apiKey, locale, agreementUrl, onCopy }) {
|
|
886
|
+
const [visibleBlockId, onReveal] = useState(null);
|
|
887
|
+
const { status, setRoot, copy } = useAgentConnectCopy(instructions.copy, onCopy);
|
|
888
|
+
const controls = {
|
|
889
|
+
locale,
|
|
890
|
+
visibleBlockId,
|
|
891
|
+
onReveal,
|
|
892
|
+
onCopy
|
|
893
|
+
};
|
|
894
|
+
const command = instructions.command;
|
|
895
|
+
const commandOffset = command ? instructions.display.indexOf(command.display) : -1;
|
|
896
|
+
const labels = resolveAgentConnectLabels(locale);
|
|
897
|
+
const message = 'copied' === status ? labels.copied : 'failed' === status ? labels.failed : '';
|
|
898
|
+
const copyLabel = instructions.fixed ? labels.copy : labels.copyMarkdown;
|
|
670
899
|
return /*#__PURE__*/ jsxs("div", {
|
|
671
900
|
ref: setRoot,
|
|
672
901
|
className: "ov-agent-connect__instructions",
|
|
@@ -682,7 +911,7 @@ function AgentConnectInstructionsView({ instructions, locale, agreementUrl, onCo
|
|
|
682
911
|
className: "ov-agent-connect__copy",
|
|
683
912
|
type: "button",
|
|
684
913
|
disabled: 'pending' === status,
|
|
685
|
-
onClick: ()=>void
|
|
914
|
+
onClick: ()=>void copy(),
|
|
686
915
|
children: [
|
|
687
916
|
/*#__PURE__*/ jsx(copyreact, {
|
|
688
917
|
"aria-hidden": "true"
|
|
@@ -694,8 +923,22 @@ function AgentConnectInstructionsView({ instructions, locale, agreementUrl, onCo
|
|
|
694
923
|
}),
|
|
695
924
|
/*#__PURE__*/ jsx("div", {
|
|
696
925
|
className: "ov-agent-connect__body",
|
|
697
|
-
children:
|
|
698
|
-
|
|
926
|
+
children: command ? /*#__PURE__*/ jsxs(Fragment, {
|
|
927
|
+
children: [
|
|
928
|
+
instructions.display.slice(0, commandOffset),
|
|
929
|
+
/*#__PURE__*/ jsx(AgentConnectCodeBlock, {
|
|
930
|
+
...controls,
|
|
931
|
+
language: "bash",
|
|
932
|
+
display: command.display,
|
|
933
|
+
copyText: command.copy
|
|
934
|
+
}),
|
|
935
|
+
instructions.display.slice(commandOffset + command.display.length)
|
|
936
|
+
]
|
|
937
|
+
}) : /*#__PURE__*/ jsx(AgentConnectMarkdown, {
|
|
938
|
+
...controls,
|
|
939
|
+
text: instructions.markdown,
|
|
940
|
+
keyToken: instructions.keyToken,
|
|
941
|
+
apiKey: apiKey
|
|
699
942
|
})
|
|
700
943
|
}),
|
|
701
944
|
/*#__PURE__*/ jsx("span", {
|
|
@@ -739,7 +982,7 @@ function AgentConnectDetailView({ selected, apiKey, locale, baseUrl, agreementUr
|
|
|
739
982
|
baseUrl,
|
|
740
983
|
revision: credentials.revision + 1
|
|
741
984
|
});
|
|
742
|
-
const labels =
|
|
985
|
+
const labels = resolveAgentConnectLabels(locale);
|
|
743
986
|
const title = selected.name.endsWith(labels.integration) ? selected.name : `${selected.name} ${labels.integration}`;
|
|
744
987
|
return /*#__PURE__*/ jsxs("section", {
|
|
745
988
|
className: "ov-agent-connect__detail",
|
|
@@ -792,6 +1035,7 @@ function AgentConnectDetailView({ selected, apiKey, locale, baseUrl, agreementUr
|
|
|
792
1035
|
}) : null,
|
|
793
1036
|
/*#__PURE__*/ jsx(AgentConnectInstructionsView, {
|
|
794
1037
|
instructions: instructions,
|
|
1038
|
+
apiKey: apiKey,
|
|
795
1039
|
locale: locale,
|
|
796
1040
|
agreementUrl: agreementUrl,
|
|
797
1041
|
onCopy: onCopy
|
|
@@ -1449,9 +1693,9 @@ const custom = [
|
|
|
1449
1693
|
Icon: sdkreact
|
|
1450
1694
|
}
|
|
1451
1695
|
];
|
|
1452
|
-
function getAgentConnectDesign(locale) {
|
|
1696
|
+
function getAgentConnectDesign(locale, showOverseasTag = false) {
|
|
1453
1697
|
const content = getAgentConnectContent(locale);
|
|
1454
|
-
const labels =
|
|
1698
|
+
const labels = resolveAgentConnectLabels(locale);
|
|
1455
1699
|
return {
|
|
1456
1700
|
tabs: [
|
|
1457
1701
|
{
|
|
@@ -1468,7 +1712,7 @@ function getAgentConnectDesign(locale) {
|
|
|
1468
1712
|
...content[item.id],
|
|
1469
1713
|
tags: [
|
|
1470
1714
|
...content[item.id].tags,
|
|
1471
|
-
...overseasAgents.has(item.id) ? [
|
|
1715
|
+
...showOverseasTag && overseasAgents.has(item.id) ? [
|
|
1472
1716
|
labels.overseas
|
|
1473
1717
|
] : []
|
|
1474
1718
|
]
|
|
@@ -1479,7 +1723,8 @@ function getAgentConnectDesign(locale) {
|
|
|
1479
1723
|
}))
|
|
1480
1724
|
};
|
|
1481
1725
|
}
|
|
1482
|
-
function AgentConnect({ apiKey, locale, baseUrl = DEFAULT_BASE_URL, agreementUrl, activeTabId: controlledTabId, selectedId: controlledSelectedId, onTabChange, onSelect, onCopy, className, ...rest }) {
|
|
1726
|
+
function AgentConnect({ apiKey, locale: localeProp, baseUrl = DEFAULT_BASE_URL, agreementUrl, showOverseasTag = false, activeTabId: controlledTabId, selectedId: controlledSelectedId, onTabChange, onSelect, onCopy, className, ...rest }) {
|
|
1727
|
+
const locale = useLocale(localeProp);
|
|
1483
1728
|
const id = useId();
|
|
1484
1729
|
const [localTabId, setLocalTabId] = useState('mainstream');
|
|
1485
1730
|
const [localSelection, setLocalSelection] = useState({
|
|
@@ -1488,8 +1733,8 @@ function AgentConnect({ apiKey, locale, baseUrl = DEFAULT_BASE_URL, agreementUrl
|
|
|
1488
1733
|
});
|
|
1489
1734
|
const activeTabId = controlledTabId ?? localTabId;
|
|
1490
1735
|
const selectedId = controlledSelectedId ?? localSelection[activeTabId];
|
|
1491
|
-
const design = getAgentConnectDesign(locale);
|
|
1492
|
-
const labels =
|
|
1736
|
+
const design = getAgentConnectDesign(locale, showOverseasTag);
|
|
1737
|
+
const labels = resolveAgentConnectLabels(locale);
|
|
1493
1738
|
const tabs = design.tabs;
|
|
1494
1739
|
const items = design[activeTabId];
|
|
1495
1740
|
const activeIndex = Math.max(0, tabs.findIndex((tab)=>tab.id === activeTabId));
|