vue-agent-start 0.1.0

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.
Files changed (169) hide show
  1. package/package.json +30 -0
  2. package/pnpm-workspace.yaml +3 -0
  3. package/src/agent-flow/adapter/backend.ts +99 -0
  4. package/src/agent-flow/components/ChatIframePanel.vue +773 -0
  5. package/src/agent-flow/components/DatasetItemCard.vue +313 -0
  6. package/src/agent-flow/components/MemoryWindow.vue +104 -0
  7. package/src/agent-flow/components/PromptEditor.vue +804 -0
  8. package/src/agent-flow/components/PromptEditorTagPanel.vue +460 -0
  9. package/src/agent-flow/components/SvgIcon.vue +32 -0
  10. package/src/agent-flow/components/ToolItemCard.vue +169 -0
  11. package/src/agent-flow/components/VariableCard.vue +161 -0
  12. package/src/agent-flow/components/VariableSelector.vue +162 -0
  13. package/src/agent-flow/components/chat-iframe-types.ts +35 -0
  14. package/src/agent-flow/components/stubs/DatasetChooser.vue +70 -0
  15. package/src/agent-flow/components/stubs/Embedding.vue +22 -0
  16. package/src/agent-flow/components/stubs/ModelSelect.vue +24 -0
  17. package/src/agent-flow/components/stubs/RestfulSelectCard.vue +24 -0
  18. package/src/agent-flow/components/stubs/ToolChooser.vue +96 -0
  19. package/src/agent-flow/components/stubs/TriggersItemCard.vue +126 -0
  20. package/src/agent-flow/components/stubs/VariableModal.vue +115 -0
  21. package/src/agent-flow/index.ts +73 -0
  22. package/src/agent-flow/stores/workflow.ts +72 -0
  23. package/src/agent-flow/utils/langUtils.ts +173 -0
  24. package/src/agent-flow/workflow/Ability.vue +65 -0
  25. package/src/agent-flow/workflow/AuthorizationItem.vue +101 -0
  26. package/src/agent-flow/workflow/ConversationVar.vue +42 -0
  27. package/src/agent-flow/workflow/CustomEdge.vue +94 -0
  28. package/src/agent-flow/workflow/EnvironmentVar.vue +40 -0
  29. package/src/agent-flow/workflow/FlowDesigner.vue +2802 -0
  30. package/src/agent-flow/workflow/Icon.vue +179 -0
  31. package/src/agent-flow/workflow/NodeConfig.vue +509 -0
  32. package/src/agent-flow/workflow/NodeConfigCard.vue +460 -0
  33. package/src/agent-flow/workflow/NodeHandle.vue +147 -0
  34. package/src/agent-flow/workflow/NodeHeaderToolbar.vue +77 -0
  35. package/src/agent-flow/workflow/NodeHoverToolbar.vue +176 -0
  36. package/src/agent-flow/workflow/OutputItemCard.vue +668 -0
  37. package/src/agent-flow/workflow/ParamTableItem.vue +200 -0
  38. package/src/agent-flow/workflow/StructTable.vue +202 -0
  39. package/src/agent-flow/workflow/VarInsertField.vue +517 -0
  40. package/src/agent-flow/workflow/VarSelectField.vue +223 -0
  41. package/src/agent-flow/workflow/VariableSelectorItem.vue +48 -0
  42. package/src/agent-flow/workflow/WfField.vue +206 -0
  43. package/src/agent-flow/workflow/_config-base.css +470 -0
  44. package/src/agent-flow/workflow/composables/useNode.js +55 -0
  45. package/src/agent-flow/workflow/index.vue +53 -0
  46. package/src/agent-flow/workflow/nodeCard/AgentNodeCard.vue +180 -0
  47. package/src/agent-flow/workflow/nodeCard/AnswerNodeCard.vue +65 -0
  48. package/src/agent-flow/workflow/nodeCard/ClassifierCard.vue +152 -0
  49. package/src/agent-flow/workflow/nodeCard/CodeNodeCard.vue +139 -0
  50. package/src/agent-flow/workflow/nodeCard/ConditionNodeCard.vue +323 -0
  51. package/src/agent-flow/workflow/nodeCard/DocumentExtractorCard.vue +83 -0
  52. package/src/agent-flow/workflow/nodeCard/EndNodeCard.vue +123 -0
  53. package/src/agent-flow/workflow/nodeCard/HttpNodeCard.vue +451 -0
  54. package/src/agent-flow/workflow/nodeCard/HumanInputCard.vue +152 -0
  55. package/src/agent-flow/workflow/nodeCard/IterationCard.vue +66 -0
  56. package/src/agent-flow/workflow/nodeCard/KnowledgeRetrievalCard.vue +48 -0
  57. package/src/agent-flow/workflow/nodeCard/LLMNodeCard.vue +206 -0
  58. package/src/agent-flow/workflow/nodeCard/ListOperatorCard.vue +188 -0
  59. package/src/agent-flow/workflow/nodeCard/ParameterExtractorCard.vue +352 -0
  60. package/src/agent-flow/workflow/nodeCard/ServiceApiNodeCard.vue +188 -0
  61. package/src/agent-flow/workflow/nodeCard/StartNodeCard.vue +216 -0
  62. package/src/agent-flow/workflow/nodeCard/VariableAssignerCard.vue +125 -0
  63. package/src/agent-flow/workflow/nodeCard/VariableNodeCard.vue +121 -0
  64. package/src/agent-flow/workflow/nodes/AgentNode.vue +122 -0
  65. package/src/agent-flow/workflow/nodes/AnswerNode.vue +99 -0
  66. package/src/agent-flow/workflow/nodes/ClassifierNode.vue +199 -0
  67. package/src/agent-flow/workflow/nodes/CodeNode.vue +152 -0
  68. package/src/agent-flow/workflow/nodes/ConditionNode.vue +232 -0
  69. package/src/agent-flow/workflow/nodes/DocumentExtractorNode.vue +96 -0
  70. package/src/agent-flow/workflow/nodes/EndNode.vue +119 -0
  71. package/src/agent-flow/workflow/nodes/FileUploadNode.vue +97 -0
  72. package/src/agent-flow/workflow/nodes/HttpNode.vue +204 -0
  73. package/src/agent-flow/workflow/nodes/HumanInputNode.vue +110 -0
  74. package/src/agent-flow/workflow/nodes/IterationNode.vue +98 -0
  75. package/src/agent-flow/workflow/nodes/KnowledgeRetrievalNode.vue +253 -0
  76. package/src/agent-flow/workflow/nodes/LLMNode.vue +134 -0
  77. package/src/agent-flow/workflow/nodes/ListOperatorNode.vue +111 -0
  78. package/src/agent-flow/workflow/nodes/LoopNode.vue +94 -0
  79. package/src/agent-flow/workflow/nodes/ParameterExtractorNode.vue +147 -0
  80. package/src/agent-flow/workflow/nodes/ServiceApiNode.vue +161 -0
  81. package/src/agent-flow/workflow/nodes/StartNode.vue +199 -0
  82. package/src/agent-flow/workflow/nodes/TemplateNode.vue +103 -0
  83. package/src/agent-flow/workflow/nodes/UserInputNode.vue +92 -0
  84. package/src/agent-flow/workflow/nodes/VariableAssignerNode.vue +145 -0
  85. package/src/agent-flow/workflow/nodes/VariableNode.vue +130 -0
  86. package/src/agent-flow/workflow/nodes/_node-base.css +338 -0
  87. package/src/agent-flow/workflow/utils/node_card_form.ts +335 -0
  88. package/src/agent-flow/workflow/utils/node_config.ts +63 -0
  89. package/src/agent-flow/workflow/utils/workflow_utils.ts +151 -0
  90. package/src/agent-studio/adapters/springAgentStart.ts +390 -0
  91. package/src/agent-studio/api/index.ts +1 -0
  92. package/src/agent-studio/api/types.ts +173 -0
  93. package/src/agent-studio/components/AgentApiDocs.vue +500 -0
  94. package/src/agent-studio/components/AgentAppsPage.vue +1601 -0
  95. package/src/agent-studio/components/AgentCardGrid.vue +259 -0
  96. package/src/agent-studio/components/AgentChatPage.vue +553 -0
  97. package/src/agent-studio/components/AgentDebugPanel.vue +350 -0
  98. package/src/agent-studio/components/AgentLogsPanel.vue +391 -0
  99. package/src/agent-studio/components/AgentMonitorPanel.vue +204 -0
  100. package/src/agent-studio/components/AgentOrchestrate.vue +505 -0
  101. package/src/agent-studio/components/AgentPromptEditor.vue +237 -0
  102. package/src/agent-studio/components/AgentStudioShell.vue +227 -0
  103. package/src/agent-studio/components/AgentToolsPanel.vue +394 -0
  104. package/src/agent-studio/components/AgentVariablesPanel.vue +205 -0
  105. package/src/agent-studio/components/ApiKeyManager.vue +251 -0
  106. package/src/agent-studio/components/AppDesignDrawer.vue +3391 -0
  107. package/src/agent-studio/components/CreateAppModal.vue +737 -0
  108. package/src/agent-studio/components/SparkChart.vue +200 -0
  109. package/src/agent-studio/components/VariableEditorModal.vue +499 -0
  110. package/src/agent-studio/composables/useAgentStudio.ts +347 -0
  111. package/src/agent-studio/index.ts +60 -0
  112. package/src/agent-studio/panels/DrawerFlowDesigner.vue +203 -0
  113. package/src/agent-studio/panels/LogAnnotationPanel.vue +490 -0
  114. package/src/agent-studio/panels/MonitorPanel.vue +535 -0
  115. package/src/agent-studio/types.ts +242 -0
  116. package/src/index.ts +155 -0
  117. package/src/knowledge-hub/adapters/springAgentStart.ts +472 -0
  118. package/src/knowledge-hub/components/AddDocumentsWizard.vue +1452 -0
  119. package/src/knowledge-hub/components/CreateDatasetWizard.vue +1723 -0
  120. package/src/knowledge-hub/components/DatasetCardGrid.vue +467 -0
  121. package/src/knowledge-hub/components/DatasetDetailDrawer.vue +888 -0
  122. package/src/knowledge-hub/components/DatasetPicker.vue +65 -0
  123. package/src/knowledge-hub/components/DatasetPickerModal.vue +526 -0
  124. package/src/knowledge-hub/components/DatasetSettingsPanel.vue +908 -0
  125. package/src/knowledge-hub/components/DatasetSidebar.vue +781 -0
  126. package/src/knowledge-hub/components/DocumentChunksView.vue +802 -0
  127. package/src/knowledge-hub/components/DocumentTable.vue +552 -0
  128. package/src/knowledge-hub/components/HitTestingPanel.vue +74 -0
  129. package/src/knowledge-hub/components/KnowledgeApp.vue +66 -0
  130. package/src/knowledge-hub/components/KnowledgeHubApp.vue +504 -0
  131. package/src/knowledge-hub/components/RecallTestingPanelV2.vue +515 -0
  132. package/src/knowledge-hub/components/RetrievalConfigPopover.vue +270 -0
  133. package/src/knowledge-hub/components/RetrievalMethodPicker.vue +547 -0
  134. package/src/knowledge-hub/components/RetrievedList.vue +24 -0
  135. package/src/knowledge-hub/components/internal/KhDialog.vue +195 -0
  136. package/src/knowledge-hub/composables/useKnowledge.ts +89 -0
  137. package/src/knowledge-hub/i18n/index.ts +2 -0
  138. package/src/knowledge-hub/i18n/messages.ts +422 -0
  139. package/src/knowledge-hub/i18n/useKhI18n.ts +107 -0
  140. package/src/knowledge-hub/index.ts +46 -0
  141. package/src/knowledge-hub/styles/index.css +4 -0
  142. package/src/knowledge-hub/styles/tokens.css +138 -0
  143. package/src/knowledge-hub/types/api.ts +213 -0
  144. package/src/knowledge-hub/types/dataset.ts +88 -0
  145. package/src/knowledge-hub/types/document.ts +45 -0
  146. package/src/knowledge-hub/types/index.ts +9 -0
  147. package/src/knowledge-hub/types/retrieval.ts +46 -0
  148. package/src/provider-hub/components/CredentialForm.vue +103 -0
  149. package/src/provider-hub/components/DefaultModelsPanel.vue +270 -0
  150. package/src/provider-hub/components/GroupedModelSelect.vue +445 -0
  151. package/src/provider-hub/components/ModelCardGrid.vue +332 -0
  152. package/src/provider-hub/components/ModelParameterDrawer.vue +739 -0
  153. package/src/provider-hub/components/ModelPickerPopover.vue +1282 -0
  154. package/src/provider-hub/components/ProviderApp.vue +159 -0
  155. package/src/provider-hub/components/ProviderCredentialModal.vue +321 -0
  156. package/src/provider-hub/components/ProviderGallery.vue +131 -0
  157. package/src/provider-hub/components/ProviderHubShell.vue +1992 -0
  158. package/src/provider-hub/components/ProviderIcon.vue +130 -0
  159. package/src/provider-hub/composables/useProviderHub.ts +358 -0
  160. package/src/provider-hub/index.ts +43 -0
  161. package/src/provider-hub/svg/MiniMax.svg +1 -0
  162. package/src/provider-hub/svg/Volcengine.svg +1 -0
  163. package/src/provider-hub/svg/Zhipu.svg +1 -0
  164. package/src/provider-hub/svg/deepseek.svg +1 -0
  165. package/src/provider-hub/svg/moonshot.svg +1 -0
  166. package/src/provider-hub/svg/openai.svg +1 -0
  167. package/src/provider-hub/svg/qwen.svg +1 -0
  168. package/src/provider-hub/svg/siliconflow.svg +1 -0
  169. package/src/provider-hub/types.ts +256 -0
@@ -0,0 +1,195 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * KhDialog — the module's internal modal primitive. Confirm + prompt in one.
4
+ *
5
+ * No dependency on antd / any UI kit. Consumers who want a custom look can
6
+ * override the CSS variables (--kh-color-primary, etc.) or replace the whole
7
+ * component by installing a similarly-shaped one via the Vue app's global
8
+ * registration.
9
+ */
10
+ import { computed, nextTick, ref, watch } from 'vue';
11
+
12
+ import { useKhI18n } from '../../i18n';
13
+
14
+ interface Props {
15
+ open: boolean;
16
+ title?: string;
17
+ content?: string;
18
+ /** When set, adds a text input pre-filled with this value. */
19
+ promptDefault?: string;
20
+ promptPlaceholder?: string;
21
+ okText?: string;
22
+ cancelText?: string;
23
+ danger?: boolean;
24
+ }
25
+
26
+ const props = defineProps<Props>();
27
+
28
+ const emit = defineEmits<{
29
+ (e: 'update:open', v: boolean): void;
30
+ (e: 'confirm', promptValue?: string): void;
31
+ (e: 'cancel'): void;
32
+ }>();
33
+
34
+ const { t } = useKhI18n();
35
+
36
+ // Seed the initial value from `promptDefault` so a component that mounts
37
+ // already-open (e.g. controlled by a `v-if="condition"` outside) shows the
38
+ // default rather than an empty input.
39
+ const inputValue = ref(props.promptDefault ?? '');
40
+ const inputRef = ref<HTMLInputElement | null>(null);
41
+
42
+ watch(
43
+ () => props.open,
44
+ async (v) => {
45
+ if (v) {
46
+ // Re-open resets the input to the current default and refocuses.
47
+ inputValue.value = props.promptDefault ?? '';
48
+ await nextTick();
49
+ inputRef.value?.focus();
50
+ inputRef.value?.select();
51
+ }
52
+ },
53
+ { immediate: true },
54
+ );
55
+
56
+ const hasPrompt = computed(() => props.promptDefault !== undefined);
57
+
58
+ function onOk() {
59
+ emit('confirm', hasPrompt.value ? inputValue.value : undefined);
60
+ emit('update:open', false);
61
+ }
62
+ function onCancel() {
63
+ emit('cancel');
64
+ emit('update:open', false);
65
+ }
66
+ function onKey(e: KeyboardEvent) {
67
+ if (e.key === 'Enter' && (!hasPrompt.value || inputValue.value.trim())) {
68
+ e.preventDefault();
69
+ onOk();
70
+ } else if (e.key === 'Escape') {
71
+ e.preventDefault();
72
+ onCancel();
73
+ }
74
+ }
75
+ </script>
76
+
77
+ <template>
78
+ <Teleport to="body" :disabled="!open">
79
+ <div v-if="open" class="khd-mask" @click.self="onCancel" @keydown="onKey">
80
+ <div class="khd-panel" tabindex="-1" @keydown="onKey">
81
+ <div v-if="title" class="khd-title">{{ title }}</div>
82
+ <div v-if="content" class="khd-content">{{ content }}</div>
83
+ <input
84
+ v-if="hasPrompt"
85
+ ref="inputRef"
86
+ v-model="inputValue"
87
+ class="khd-input"
88
+ :placeholder="promptPlaceholder"
89
+ />
90
+ <div class="khd-actions">
91
+ <button class="khd-btn khd-btn-secondary" @click="onCancel">
92
+ {{ cancelText ?? t('common.cancel') }}
93
+ </button>
94
+ <button
95
+ class="khd-btn"
96
+ :class="danger ? 'khd-btn-danger' : 'khd-btn-primary'"
97
+ :disabled="hasPrompt && !inputValue.trim()"
98
+ @click="onOk"
99
+ >
100
+ {{ okText ?? t('common.ok') }}
101
+ </button>
102
+ </div>
103
+ </div>
104
+ </div>
105
+ </Teleport>
106
+ </template>
107
+
108
+ <style scoped>
109
+ .khd-mask {
110
+ position: fixed;
111
+ inset: 0;
112
+ z-index: var(--kh-z-modal);
113
+ background: rgba(15, 23, 42, 0.5);
114
+ display: flex;
115
+ align-items: center;
116
+ justify-content: center;
117
+ }
118
+ .khd-panel {
119
+ width: min(440px, 92vw);
120
+ padding: 22px 24px 18px;
121
+ background: var(--kh-color-surface);
122
+ border-radius: var(--kh-radius-lg);
123
+ box-shadow: var(--kh-shadow-modal);
124
+ outline: none;
125
+ display: flex;
126
+ flex-direction: column;
127
+ gap: var(--kh-space-3);
128
+ }
129
+ .khd-title {
130
+ font-size: var(--kh-fs-3xl);
131
+ font-weight: 600;
132
+ color: var(--kh-color-text-primary);
133
+ }
134
+ .khd-content {
135
+ font-size: var(--kh-fs-lg);
136
+ color: var(--kh-color-text-secondary);
137
+ line-height: 1.55;
138
+ }
139
+ .khd-input {
140
+ padding: 8px 12px;
141
+ font-size: var(--kh-fs-lg);
142
+ border: 1px solid var(--kh-input-border);
143
+ border-radius: var(--kh-input-radius);
144
+ outline: none;
145
+ background: var(--kh-input-bg);
146
+ color: var(--kh-color-text-primary);
147
+ font-family: inherit;
148
+ }
149
+ .khd-input:focus {
150
+ border-color: var(--kh-color-primary);
151
+ box-shadow: var(--kh-focus-ring);
152
+ }
153
+ .khd-actions {
154
+ display: flex;
155
+ justify-content: flex-end;
156
+ gap: var(--kh-space-2);
157
+ margin-top: var(--kh-space-2);
158
+ }
159
+ .khd-btn {
160
+ padding: 6px 18px;
161
+ border: none;
162
+ border-radius: var(--kh-radius-sm);
163
+ font-size: var(--kh-fs-lg);
164
+ font-weight: 500;
165
+ cursor: pointer;
166
+ transition:
167
+ background var(--kh-tx-fast),
168
+ transform 0.05s ease;
169
+ }
170
+ .khd-btn:disabled {
171
+ opacity: 0.6;
172
+ cursor: not-allowed;
173
+ }
174
+ .khd-btn-primary {
175
+ background: var(--kh-color-primary);
176
+ color: var(--kh-color-primary-contrast);
177
+ }
178
+ .khd-btn-primary:hover:not(:disabled) {
179
+ background: var(--kh-color-primary-strong);
180
+ }
181
+ .khd-btn-danger {
182
+ background: var(--kh-color-danger);
183
+ color: var(--kh-color-primary-contrast);
184
+ }
185
+ .khd-btn-danger:hover:not(:disabled) {
186
+ opacity: 0.9;
187
+ }
188
+ .khd-btn-secondary {
189
+ background: var(--kh-color-surface-hover);
190
+ color: var(--kh-color-text-secondary);
191
+ }
192
+ .khd-btn-secondary:hover {
193
+ background: var(--kh-color-border);
194
+ }
195
+ </style>
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Tiny fetch-based client. Doesn't take a hard dep on axios / the host app's
3
+ * request layer so the module can be pulled into any Vue 3 app.
4
+ *
5
+ * Consumers can either set the base URL once via {@link setKnowledgeApiBase} or
6
+ * pass it per-call. Failing responses throw so callers can catch/ toast as they
7
+ * see fit.
8
+ */
9
+ import type { Dataset, RetrieveRequest, RetrievedSegment } from '../types';
10
+
11
+ // `/agent-start` 是 spring-agent-web 给每个控制器加的固定命名空间前缀,属于
12
+ // 组件与后端约定的实现细节,宿主不用关心 —— 组件内部自己拼上就行。宿主
13
+ // 只需要告诉我们它转发到后端的代理前缀(默认 `/api`)。若代理不叫 /api,
14
+ // 传自定义 apiBase 或调 setKnowledgeApiBase() 覆盖。
15
+ const AGENT_START_NAMESPACE = '/agent-start';
16
+ let apiBase = '/api';
17
+
18
+ /**
19
+ * 追加到每个请求的 header。传函数会在每次请求前重新求值,方便宿主接入
20
+ * pinia store 里的 access-token —— 登录/退出时不用重挂 composable。
21
+ */
22
+ export type HeadersLike =
23
+ | Record<string, string>
24
+ | (() => Promise<Record<string, string>> | Record<string, string>);
25
+
26
+ let headersProvider: () => Promise<Record<string, string>> | Record<string, string> = () => ({});
27
+
28
+ export function setKnowledgeApiBase(base: string) {
29
+ apiBase = base.replace(/\/+$/, '');
30
+ }
31
+
32
+ /**
33
+ * 设置每次请求都会拼上的 header(如 Authorization)。示例:
34
+ * setKnowledgeHeaders(() => ({
35
+ * Authorization: `Bearer ${useAccessStore().accessToken}`,
36
+ * }));
37
+ */
38
+ export function setKnowledgeHeaders(headers: HeadersLike) {
39
+ headersProvider = typeof headers === 'function' ? headers : () => headers;
40
+ }
41
+
42
+ function buildUrl(path: string): string {
43
+ return `${apiBase}${AGENT_START_NAMESPACE}${path.startsWith('/') ? '' : '/'}${path}`;
44
+ }
45
+
46
+ async function resolveHeaders(): Promise<Record<string, string>> {
47
+ return (await headersProvider()) ?? {};
48
+ }
49
+
50
+ interface Envelope<T> {
51
+ code: string;
52
+ message?: string;
53
+ data: T;
54
+ }
55
+
56
+ async function call<T>(path: string, init: RequestInit = {}): Promise<T> {
57
+ const injected = await resolveHeaders();
58
+ const res = await fetch(buildUrl(path), {
59
+ headers: {
60
+ 'Content-Type': 'application/json',
61
+ ...injected,
62
+ ...(init.headers ?? {}),
63
+ },
64
+ ...init,
65
+ });
66
+ if (!res.ok) {
67
+ throw new Error(`${res.status} ${res.statusText}`);
68
+ }
69
+ const env = (await res.json()) as Envelope<T>;
70
+ if (env.code !== 'ok') {
71
+ throw new Error(env.message ?? env.code);
72
+ }
73
+ return env.data;
74
+ }
75
+
76
+ export function useKnowledge() {
77
+ return {
78
+ listDatasets: (tenantId?: string) =>
79
+ call<Dataset[]>(
80
+ `/datasets${tenantId ? `?tenantId=${encodeURIComponent(tenantId)}` : ''}`,
81
+ ),
82
+ getDataset: (id: string) => call<Dataset>(`/datasets/${id}`),
83
+ retrieve: (datasetId: string, req: RetrieveRequest) =>
84
+ call<RetrievedSegment[]>(`/datasets/${datasetId}/retrieve`, {
85
+ method: 'POST',
86
+ body: JSON.stringify(req),
87
+ }),
88
+ };
89
+ }
@@ -0,0 +1,2 @@
1
+ export * from './messages';
2
+ export * from './useKhI18n';
@@ -0,0 +1,422 @@
1
+ /**
2
+ * i18n message catalog for @agent-start/knowledge-hub.
3
+ *
4
+ * Every user-visible string is keyed here. Extending: a host can pass a
5
+ * partial catalog to `<KnowledgeHubApp :locale="myLocale">` to override any
6
+ * key without shipping a whole new catalog. Missing keys fall back to en-US
7
+ * (which is complete).
8
+ */
9
+
10
+ export interface KhMessages {
11
+ app: {
12
+ title: string;
13
+ description: string;
14
+ searchPlaceholder: string;
15
+ loading: string;
16
+ /**
17
+ * First-time-use nudge shown at the top of the list when the tenant has
18
+ * no embedding model registered yet. Falls back to Chinese defaults; a
19
+ * host can override the whole catalog via {@code <KnowledgeHubApp :locale>}.
20
+ */
21
+ nudgeEmbeddingTitle: string;
22
+ nudgeEmbeddingDesc: string;
23
+ nudgeEmbeddingCta: string;
24
+ };
25
+ card: {
26
+ createTitle: string;
27
+ createSubtitle: string;
28
+ noDescription: string;
29
+ docs: string;
30
+ chunks: string;
31
+ delete: string;
32
+ confirmDelete: string;
33
+ more: string;
34
+ open: string;
35
+ settings: string;
36
+ };
37
+ wizard: {
38
+ stepChooseSource: string;
39
+ stepChunking: string;
40
+ stepDone: string;
41
+ back: string;
42
+ next: string;
43
+ prev: string;
44
+ saveAndProcess: string;
45
+ createEmpty: string;
46
+ createEmptyPromptTitle: string;
47
+ createEmptyPromptDefault: string;
48
+ chooseSource: string;
49
+ uploadFiles: string;
50
+ dropOrChoose: string;
51
+ dropZoneHint: string;
52
+ };
53
+ detail: {
54
+ tabDocuments: string;
55
+ tabPipeline: string;
56
+ tabRecall: string;
57
+ tabSettings: string;
58
+ accessApi: string;
59
+ apiCopied: string;
60
+ apiCopyFailed: string;
61
+ pipelineStubTitle: string;
62
+ pipelineStubSub: string;
63
+ };
64
+ documents: {
65
+ intro: string;
66
+ addFile: string;
67
+ metadata: string;
68
+ filterAll: string;
69
+ filterAvailable: string;
70
+ filterFailed: string;
71
+ searchPlaceholder: string;
72
+ sortUploadedDesc: string;
73
+ sortUploadedAsc: string;
74
+ sortName: string;
75
+ colHash: string;
76
+ colName: string;
77
+ colMode: string;
78
+ colWords: string;
79
+ colHits: string;
80
+ colUploadedAt: string;
81
+ colStatus: string;
82
+ colActions: string;
83
+ statusAvailable: string;
84
+ statusDisabled: string;
85
+ statusFailed: string;
86
+ statusProcessing: string;
87
+ emptyNoDocuments: string;
88
+ emptyNoMatches: string;
89
+ };
90
+ chunks: {
91
+ addChunk: string;
92
+ filterAll: string;
93
+ filterEnabled: string;
94
+ filterDisabled: string;
95
+ emptyNoMatches: string;
96
+ enabled: string;
97
+ disabled: string;
98
+ editorTitle: string;
99
+ editorHint: string;
100
+ save: string;
101
+ cancel: string;
102
+ delete: string;
103
+ confirmDeleteChunk: string;
104
+ };
105
+ recall: {
106
+ title: string;
107
+ subtitle: string;
108
+ sourceText: string;
109
+ placeholder: string;
110
+ test: string;
111
+ methodVector: string;
112
+ methodFullText: string;
113
+ methodHybrid: string;
114
+ recentTitle: string;
115
+ recentEmpty: string;
116
+ resultsEmpty: string;
117
+ hits: string;
118
+ };
119
+ settings: {
120
+ title: string;
121
+ subtitle: string;
122
+ labelName: string;
123
+ labelDescription: string;
124
+ labelPermission: string;
125
+ labelChunkMode: string;
126
+ labelIndexing: string;
127
+ labelEmbedding: string;
128
+ labelAutoSummary: string;
129
+ labelRetrieval: string;
130
+ permissionOnlyMe: string;
131
+ permissionOrg: string;
132
+ save: string;
133
+ cancel: string;
134
+ saved: string;
135
+ saveFailed: string;
136
+ };
137
+ common: {
138
+ ok: string;
139
+ cancel: string;
140
+ delete: string;
141
+ confirm: string;
142
+ createdSuccess: string;
143
+ createFailed: string;
144
+ uploadFailed: string;
145
+ loadFailed: string;
146
+ deleteSuccess: string;
147
+ };
148
+ }
149
+
150
+ export const zhCN: KhMessages = {
151
+ app: {
152
+ title: '知识库',
153
+ description: 'Datasets · 文档 · 检索。',
154
+ searchPlaceholder: '搜索知识库...',
155
+ loading: '加载中…',
156
+ nudgeEmbeddingTitle: '第一步:先注册一个 Embedding 模型',
157
+ nudgeEmbeddingDesc:
158
+ '高质量知识库需要 Embedding 模型来向量化文档。也可以直接创建"经济"模式的知识库,只用关键词检索。',
159
+ nudgeEmbeddingCta: '去配置模型',
160
+ },
161
+ card: {
162
+ createTitle: '新建知识库',
163
+ createSubtitle: '导入文档 / 上传文件 / 空知识库',
164
+ noDescription: '暂无描述',
165
+ docs: '文档',
166
+ chunks: '片段',
167
+ delete: '删除',
168
+ confirmDelete: '确认删除「{name}」?该操作不可恢复。',
169
+ more: '更多操作',
170
+ open: '打开',
171
+ settings: '设置',
172
+ },
173
+ wizard: {
174
+ stepChooseSource: '选择数据源',
175
+ stepChunking: '文本分段与清洗',
176
+ stepDone: '处理并完成',
177
+ back: '返回',
178
+ next: '下一步',
179
+ prev: '上一步',
180
+ saveAndProcess: '保存并处理',
181
+ createEmpty: '创建一个空知识库',
182
+ createEmptyPromptTitle: '新知识库名称',
183
+ createEmptyPromptDefault: '空知识库',
184
+ chooseSource: '选择数据源',
185
+ uploadFiles: '上传文本文件',
186
+ dropOrChoose: '拖拽文件或文件夹至此,或者',
187
+ dropZoneHint: '每批最多 5 个文件,每个文件不超过 15 MB。',
188
+ },
189
+ detail: {
190
+ tabDocuments: '文档',
191
+ tabPipeline: '流水线',
192
+ tabRecall: '召回测试',
193
+ tabSettings: '设置',
194
+ accessApi: '访问 API',
195
+ apiCopied: '已复制 API 地址',
196
+ apiCopyFailed: '复制失败',
197
+ pipelineStubTitle: '流水线',
198
+ pipelineStubSub: '未来将在此展示数据处理流水线(清洗 · 分段 · 嵌入 · 索引)的实时状态。',
199
+ },
200
+ documents: {
201
+ intro: '知识库的所有文件都在这里显示。',
202
+ addFile: '添加文件',
203
+ metadata: '元数据',
204
+ filterAll: '全部',
205
+ filterAvailable: '可用',
206
+ filterFailed: '失败',
207
+ searchPlaceholder: '搜索',
208
+ sortUploadedDesc: '排序:上传时间 ↓',
209
+ sortUploadedAsc: '排序:上传时间 ↑',
210
+ sortName: '排序:名称',
211
+ colHash: '#',
212
+ colName: '名称',
213
+ colMode: '分段模式',
214
+ colWords: '字数',
215
+ colHits: '召回次数',
216
+ colUploadedAt: '上传时间',
217
+ colStatus: '状态',
218
+ colActions: '操作',
219
+ statusAvailable: '可用',
220
+ statusDisabled: '已停用',
221
+ statusFailed: '失败',
222
+ statusProcessing: '处理中',
223
+ emptyNoDocuments: '还没有文档。点击右上角"添加文件"上传。',
224
+ emptyNoMatches: '没有匹配的文档',
225
+ },
226
+ chunks: {
227
+ addChunk: '添加分段',
228
+ filterAll: '全部',
229
+ filterEnabled: '已启用',
230
+ filterDisabled: '已停用',
231
+ emptyNoMatches: '没有匹配的分段',
232
+ enabled: '已启用',
233
+ disabled: '已停用',
234
+ editorTitle: '编辑分段',
235
+ editorHint: '保存后会重新计算 embedding 并入向量库,可能需要几秒。',
236
+ save: '保存',
237
+ cancel: '取消',
238
+ delete: '删除',
239
+ confirmDeleteChunk: '删除后该分段不会再被检索,操作不可撤销。',
240
+ },
241
+ recall: {
242
+ title: '召回测试',
243
+ subtitle: '根据给定的查询文本测试知识的召回效果。',
244
+ sourceText: '源文本',
245
+ placeholder: '请输入文本,建议使用简短的陈述句。',
246
+ test: '测试',
247
+ methodVector: '向量检索',
248
+ methodFullText: '全文检索',
249
+ methodHybrid: '混合检索',
250
+ recentTitle: '记录',
251
+ recentEmpty: '最近无查询结果',
252
+ resultsEmpty: '召回测试结果显示在这里',
253
+ hits: '命中 {n} 个片段',
254
+ },
255
+ settings: {
256
+ title: '知识库设置',
257
+ subtitle: '在这里,您可以修改此知识库的属性和检索设置',
258
+ labelName: '名称和图标',
259
+ labelDescription: '描述',
260
+ labelPermission: '可见权限',
261
+ labelChunkMode: '分段模式',
262
+ labelIndexing: '索引模式',
263
+ labelEmbedding: 'Embedding 模型',
264
+ labelAutoSummary: '摘要自动生成',
265
+ labelRetrieval: '检索设置',
266
+ permissionOnlyMe: '只有我',
267
+ permissionOrg: '团队成员',
268
+ save: '保存',
269
+ cancel: '取消',
270
+ saved: '设置已保存',
271
+ saveFailed: '保存失败',
272
+ },
273
+ common: {
274
+ ok: '确定',
275
+ cancel: '取消',
276
+ delete: '删除',
277
+ confirm: '确认',
278
+ createdSuccess: '已创建',
279
+ createFailed: '创建失败',
280
+ uploadFailed: '上传失败',
281
+ loadFailed: '加载失败',
282
+ deleteSuccess: '已删除',
283
+ },
284
+ };
285
+
286
+ export const enUS: KhMessages = {
287
+ app: {
288
+ title: 'Knowledge Base',
289
+ description: 'Datasets · Documents · Retrieval.',
290
+ searchPlaceholder: 'Search knowledge bases...',
291
+ loading: 'Loading…',
292
+ nudgeEmbeddingTitle: 'Step 1 — Register an embedding model first',
293
+ nudgeEmbeddingDesc:
294
+ 'High-quality knowledge bases need an embedding model to vectorise documents. You can also create an "economy" KB that only uses keyword search.',
295
+ nudgeEmbeddingCta: 'Configure a model',
296
+ },
297
+ card: {
298
+ createTitle: 'New Knowledge Base',
299
+ createSubtitle: 'Import documents / upload files / empty KB',
300
+ noDescription: 'No description',
301
+ docs: 'Docs',
302
+ chunks: 'Chunks',
303
+ delete: 'Delete',
304
+ confirmDelete: 'Delete "{name}"? This cannot be undone.',
305
+ more: 'More',
306
+ open: 'Open',
307
+ settings: 'Settings',
308
+ },
309
+ wizard: {
310
+ stepChooseSource: 'Choose Data Source',
311
+ stepChunking: 'Chunking & Cleaning',
312
+ stepDone: 'Process & Done',
313
+ back: 'Back',
314
+ next: 'Next',
315
+ prev: 'Previous',
316
+ saveAndProcess: 'Save & Process',
317
+ createEmpty: 'Create empty knowledge base',
318
+ createEmptyPromptTitle: 'New knowledge base name',
319
+ createEmptyPromptDefault: 'Empty KB',
320
+ chooseSource: 'Choose data source',
321
+ uploadFiles: 'Upload text files',
322
+ dropOrChoose: 'Drag files or folders here, or',
323
+ dropZoneHint: 'Up to 5 files per batch, 15 MB each.',
324
+ },
325
+ detail: {
326
+ tabDocuments: 'Documents',
327
+ tabPipeline: 'Pipeline',
328
+ tabRecall: 'Recall Testing',
329
+ tabSettings: 'Settings',
330
+ accessApi: 'Access API',
331
+ apiCopied: 'API URL copied',
332
+ apiCopyFailed: 'Copy failed',
333
+ pipelineStubTitle: 'Pipeline',
334
+ pipelineStubSub: 'Live status of clean · chunk · embed · index steps will appear here.',
335
+ },
336
+ documents: {
337
+ intro: 'All files in the knowledge base are shown here.',
338
+ addFile: 'Add File',
339
+ metadata: 'Metadata',
340
+ filterAll: 'All',
341
+ filterAvailable: 'Available',
342
+ filterFailed: 'Failed',
343
+ searchPlaceholder: 'Search',
344
+ sortUploadedDesc: 'Sort: uploaded ↓',
345
+ sortUploadedAsc: 'Sort: uploaded ↑',
346
+ sortName: 'Sort: name',
347
+ colHash: '#',
348
+ colName: 'Name',
349
+ colMode: 'Chunk mode',
350
+ colWords: 'Words',
351
+ colHits: 'Recalls',
352
+ colUploadedAt: 'Uploaded at',
353
+ colStatus: 'Status',
354
+ colActions: 'Actions',
355
+ statusAvailable: 'Available',
356
+ statusDisabled: 'Disabled',
357
+ statusFailed: 'Failed',
358
+ statusProcessing: 'Processing',
359
+ emptyNoDocuments: 'No documents yet. Click "Add File" to upload.',
360
+ emptyNoMatches: 'No matching documents',
361
+ },
362
+ chunks: {
363
+ addChunk: 'Add chunk',
364
+ filterAll: 'All',
365
+ filterEnabled: 'Enabled',
366
+ filterDisabled: 'Disabled',
367
+ emptyNoMatches: 'No matching chunks',
368
+ enabled: 'Enabled',
369
+ disabled: 'Disabled',
370
+ editorTitle: 'Edit chunk',
371
+ editorHint: 'Saving re-embeds this chunk. Takes a few seconds.',
372
+ save: 'Save',
373
+ cancel: 'Cancel',
374
+ delete: 'Delete',
375
+ confirmDeleteChunk: 'This chunk will no longer match retrieval queries.',
376
+ },
377
+ recall: {
378
+ title: 'Recall Testing',
379
+ subtitle: 'Test how well this knowledge base recalls for a given query.',
380
+ sourceText: 'Source text',
381
+ placeholder: 'Enter text — a short declarative sentence works best.',
382
+ test: 'Test',
383
+ methodVector: 'Vector',
384
+ methodFullText: 'Full-text',
385
+ methodHybrid: 'Hybrid',
386
+ recentTitle: 'History',
387
+ recentEmpty: 'No recent queries',
388
+ resultsEmpty: 'Recall results will appear here',
389
+ hits: 'Matched {n} chunks',
390
+ },
391
+ settings: {
392
+ title: 'Knowledge Base Settings',
393
+ subtitle: 'Adjust the identity and retrieval config of this knowledge base.',
394
+ labelName: 'Name & Icon',
395
+ labelDescription: 'Description',
396
+ labelPermission: 'Visibility',
397
+ labelChunkMode: 'Chunk mode',
398
+ labelIndexing: 'Index mode',
399
+ labelEmbedding: 'Embedding model',
400
+ labelAutoSummary: 'Auto summary',
401
+ labelRetrieval: 'Retrieval',
402
+ permissionOnlyMe: 'Only me',
403
+ permissionOrg: 'Team members',
404
+ save: 'Save',
405
+ cancel: 'Cancel',
406
+ saved: 'Settings saved',
407
+ saveFailed: 'Save failed',
408
+ },
409
+ common: {
410
+ ok: 'OK',
411
+ cancel: 'Cancel',
412
+ delete: 'Delete',
413
+ confirm: 'Confirm',
414
+ createdSuccess: 'Created',
415
+ createFailed: 'Create failed',
416
+ uploadFailed: 'Upload failed',
417
+ loadFailed: 'Load failed',
418
+ deleteSuccess: 'Deleted',
419
+ },
420
+ };
421
+
422
+ export const DEFAULT_LOCALE: KhMessages = zhCN;