Skip to content

Commit da789bb

Browse files
committed
refactor(ui): 重组 composables 目录结构并优化模式功能
**目录结构重构**: - 将 41 个 composables 文件按功能分类到 10 个子目录 - model/ - 模型管理相关(5个文件) - prompt/ - 提示词相关(6个文件) - context/ - 上下文相关(2个文件) - image/ - 图像相关(2个文件) - ui/ - UI交互相关(11个文件) - accessibility/ - 无障碍相关(3个文件) - performance/ - 性能优化相关(4个文件) - storage/ - 存储相关(3个文件) - system/ - 系统相关(2个文件) - mode/ - 功能模式相关(4个文件) **技术实现**: - 使用 git mv 保留文件历史 - 为每个子目录创建 barrel export (index.ts) - 更新 120+ 处导入路径引用 - 修复测试文件中的导入路径 **功能优化**: - 新增 useCurrentMode composable 提供只读模式访问 - 基础模式下隐藏变量相关UI组件 - 优化 TestAreaPanel 根据功能模式动态显示变量表单 **影响范围**: - 移动文件:41个 composables - 新增文件:10个 index.ts - 更新导入:120+ 处导入路径 - 测试修复:3个测试文件路径更新
1 parent 8de8a84 commit da789bb

File tree

90 files changed

+327
-146
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+327
-146
lines changed

packages/ui/src/components/BasicTestMode.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ import { ref, computed, watch, nextTick } from 'vue'
149149
150150
import { useI18n } from 'vue-i18n'
151151
import { NButton, NCard } from 'naive-ui'
152-
import { useToast } from '../composables/useToast'
152+
import { useToast } from '../composables/ui/useToast'
153153
import type { AppServices } from '../types/services'
154154
import InputPanelUI from './InputPanel.vue'
155155
import ModelSelectUI from './ModelSelect.vue'

packages/ui/src/components/BuiltinTemplateLanguageSwitch.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { ref, onMounted, computed, inject, type Ref } from 'vue'
3131
3232
import { useI18n } from 'vue-i18n'
3333
import { NButton } from 'naive-ui'
34-
import { useToast } from '../composables/useToast'
34+
import { useToast } from '../composables/ui/useToast'
3535
import type { BuiltinTemplateLanguage } from '@prompt-optimizer/core'
3636
import type { AppServices } from '../types/services'
3737

packages/ui/src/components/CategoryManager.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ import {
152152
Plus,
153153
Folder
154154
} from '@vicons/tabler';
155-
import { useToast } from '../composables/useToast';
155+
import { useToast } from '../composables/ui/useToast';
156156
import { useI18n } from 'vue-i18n';
157157
import type { FavoriteCategory } from '@prompt-optimizer/core';
158158
import type { AppServices } from '../types/services';

packages/ui/src/components/DataManager.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ import {
187187
NModal, NSpace, NText, NButton, NUpload, NUploadDragger,
188188
NIcon, NAlert, type UploadFileInfo
189189
} from 'naive-ui'
190-
import { useToast } from '../composables/useToast'
190+
import { useToast } from '../composables/ui/useToast'
191191
import type { AppServices } from '../types/services'
192192
193193
interface Props {

packages/ui/src/components/FavoriteButton.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ import {
105105
type FormInst,
106106
type FormRules
107107
} from 'naive-ui';
108-
import { useToast } from '../composables/useToast';
108+
import { useToast } from '../composables/ui/useToast';
109109
import { StarFilled, StarOutline } from '@vicons/tabler';
110110
import type { FavoriteCategory } from '@prompt-optimizer/core';
111111
import type { AppServices } from '../types/services';

packages/ui/src/components/FavoriteCard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ import {
285285
} from '@vicons/tabler';
286286
import { useI18n } from 'vue-i18n';
287287
import type { FavoritePrompt, FavoriteCategory } from '@prompt-optimizer/core';
288-
import { useTooltipTheme } from '../composables/useTooltipTheme';
288+
import { useTooltipTheme } from '../composables/ui/useTooltipTheme';
289289
290290
const { t } = useI18n();
291291

packages/ui/src/components/FavoriteManager.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,8 @@ import {
267267
type UploadChangeParam
268268
} from 'naive-ui';
269269
import { useI18n } from 'vue-i18n';
270-
import { useToast } from '../composables/useToast';
271-
import { useFavoriteInitializer } from '../composables/useFavoriteInitializer';
270+
import { useToast } from '../composables/ui/useToast';
271+
import { useFavoriteInitializer } from '../composables/storage/useFavoriteInitializer';
272272
import ToastUI from './Toast.vue';
273273
274274
const { t } = useI18n();

packages/ui/src/components/HistoryDrawer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ import {
188188
NDivider, NCollapse, NCollapseItem, NEmpty
189189
} from 'naive-ui'
190190
import type { PromptRecord, PromptRecordChain } from '@prompt-optimizer/core'
191-
import { useToast } from '../composables/useToast'
191+
import { useToast } from '../composables/ui/useToast'
192192
193193
const props = defineProps({
194194
show: Boolean,

packages/ui/src/components/ImageModelEditModal.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@ import {
220220
NCheckbox, NSelect, NButton, NTag, NTooltip, NText,
221221
NDivider, NH4, NForm, NFormItem, NImage
222222
} from 'naive-ui'
223-
import { useImageModelManager } from '../composables/useImageModelManager'
224-
import { useToast } from '../composables/useToast'
223+
import { useImageModelManager } from '../composables/model/useImageModelManager'
224+
import { useToast } from '../composables/ui/useToast'
225225
import type { ImageModelConfig } from '@prompt-optimizer/core'
226226
import ModelAdvancedSection from './ModelAdvancedSection.vue'
227227

packages/ui/src/components/ImageModelManager.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ import { useI18n } from 'vue-i18n'
145145
import {
146146
NSpace, NCard, NText, NTag, NButton, NEmpty, NImage
147147
} from 'naive-ui'
148-
import { useImageModelManager } from '../composables/useImageModelManager'
149-
import { useToast } from '../composables/useToast'
148+
import { useImageModelManager } from '../composables/model/useImageModelManager'
149+
import { useToast } from '../composables/ui/useToast'
150150
import type { IImageService } from '@prompt-optimizer/core'
151151
152152
const { t } = useI18n()

0 commit comments

Comments
 (0)