feat(i18n): 将前端用户可见中文硬编码改为四语言
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
dce915ea30
commit
ac7b53a523
105 files changed
+2928
-647
No files matched your search
@@ -1,4 +1,11 @@
|
||||
/**
|
||||
* features/chat/composables/useToolRunProgress.ts
|
||||
* 用途:轮询 Tool/文件检核任务进度,并在执行中锁定输入。
|
||||
* 依赖:vue-i18n、toolRunProgress.api、toolRunProgressConfig。
|
||||
* 逻辑:Chat 页 progress 卡片消费;lockMessage / queryFailed 走 chat.toolRun.*。
|
||||
*/
|
||||
import { computed, onBeforeUnmount, ref, type Ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { buildFileCheckLogProgressUrl } from '../utils/toolRunProgressConfig';
|
||||
import { getToolRunProgress, type ToolRunProgress } from '../api/toolRunProgress.api';
|
||||
import type { ToolRunProgressMatchSource } from '../types/tool-run-progress.types';
|
||||
@@ -43,11 +50,15 @@ const isTerminalStatus = (status?: string | null) => TERMINAL_STATUSES.has(Strin
|
||||
|
||||
/**
|
||||
* 轮询任务进度:有 run_id 时走 detail;或走 for-log / active。
|
||||
* 核心逻辑:按 config 选择 detail/session/active URL;running 时定时刷新;终态停表。
|
||||
* @param configRef - 进度轮询配置
|
||||
* @param options.allowEmptySessionPolls - 允许 for-session 空结果继续重试
|
||||
*/
|
||||
export function useToolRunProgress(
|
||||
configRef: Ref<ToolRunProgressConfig | null>,
|
||||
options: UseToolRunProgressOptions = {},
|
||||
) {
|
||||
const { t } = useI18n();
|
||||
const run = ref<ToolRunProgress | null>(null);
|
||||
const matchSource = ref<ToolRunProgressMatchSource | null>(null);
|
||||
const loading = ref(false);
|
||||
@@ -68,7 +79,7 @@ export function useToolRunProgress(
|
||||
|
||||
const isRunning = computed(() => run.value?.status === 'running');
|
||||
const shouldLockInput = computed(() => Boolean(configRef.value?.lock_input_when_running) && isRunning.value);
|
||||
const lockMessage = computed(() => configRef.value?.lock_message || '当前任务执行中,请等待完成');
|
||||
const lockMessage = computed(() => configRef.value?.lock_message || t('chat.toolRun.lockWaiting'));
|
||||
|
||||
const clearTimer = () => {
|
||||
if (timer !== undefined) {
|
||||
@@ -100,7 +111,7 @@ export function useToolRunProgress(
|
||||
matchSource.value = payload.match_source ?? null;
|
||||
return payload.run ?? null;
|
||||
} catch (e: unknown) {
|
||||
const message = e instanceof Error ? e.message : '任务进度查询失败';
|
||||
const message = e instanceof Error ? e.message : t('chat.toolRun.queryFailed');
|
||||
error.value = message;
|
||||
matchSource.value = null;
|
||||
clearTimer();
|
||||
|
||||
Reference in new issue
Block a user