diff --git a/AGENTS.md b/AGENTS.md index 7fc7c7821..badf65192 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -15,6 +15,7 @@ - `pnpm preview`: preview the built frontend locally. - `pnpm lint` / `pnpm lint:fix`: run ESLint (and auto-fix) on the frontend. - `pnpm type-check`: run `vue-tsc` for frontend type checks. +- Before committing frontend changes, regenerate `components.d.ts` (for auto-imported components) and include it in the same commit. - Backend (run in `service/`): `pnpm install`, `pnpm start` (dev), `pnpm build`, `pnpm prod`. - Backend checks (run in `service/`): `pnpm lint`, `pnpm lint:fix`, `pnpm type-check`. diff --git a/components.d.ts b/components.d.ts index 6c64221b4..2fe348348 100644 --- a/components.d.ts +++ b/components.d.ts @@ -27,6 +27,7 @@ declare module 'vue' { IconRiBubbleChartFill: typeof import('~icons/ri/bubble-chart-fill')['default'] IconRiChatDownloadLine: typeof import('~icons/ri/chat-download-line')['default'] IconRiChatHistoryLine: typeof import('~icons/ri/chat-history-line')['default'] + IconRiChatNewLine: typeof import('~icons/ri/chat-new-line')['default'] IconRiChatQuoteLine: typeof import('~icons/ri/chat-quote-line')['default'] IconRiChatUploadLine: typeof import('~icons/ri/chat-upload-line')['default'] IconRiCloseCircleLine: typeof import('~icons/ri/close-circle-line')['default'] @@ -53,6 +54,7 @@ declare module 'vue' { IconRiSettings4Line: typeof import('~icons/ri/settings4-line')['default'] IconRiSettingsLine: typeof import('~icons/ri/settings-line')['default'] IconRiStopCircleLine: typeof import('~icons/ri/stop-circle-line')['default'] + IconRiStore2Line: typeof import('~icons/ri/store2-line')['default'] IconRiUpload2Fill: typeof import('~icons/ri/upload2-fill')['default'] IconRiUser5Line: typeof import('~icons/ri/user5-line')['default'] IconUilExit: typeof import('~icons/uil/exit')['default'] diff --git a/src/assets/recommend.json b/src/assets/recommend.json deleted file mode 100644 index 8f29eb700..000000000 --- a/src/assets/recommend.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "title": "awesome-chatgpt-prompts-zh", - "desc": "ChatGPT 中文调教指南", - "downloadUrl": "https://raw.githubusercontent.com/PlexPt/awesome-chatgpt-prompts-zh/main/prompts-zh.json", - "url": "https://github.com/PlexPt/awesome-chatgpt-prompts-zh" - }, - { - "title": "awesome-chatgpt-prompts-zh-TW", - "desc": "ChatGPT 中文調教指南 (透過 OpenAI / OpenCC 協助,從簡體中文轉換為繁體中文的版本)", - "downloadUrl": "https://raw.githubusercontent.com/PlexPt/awesome-chatgpt-prompts-zh/main/prompts-zh-TW.json", - "url": "https://github.com/PlexPt/awesome-chatgpt-prompts-zh" - } -] diff --git a/src/components/common/PromptStore/index.vue b/src/components/common/PromptStore/index.vue index fb0f9f0c5..ff5cee65a 100644 --- a/src/components/common/PromptStore/index.vue +++ b/src/components/common/PromptStore/index.vue @@ -6,7 +6,6 @@ import { UserPrompt } from '@/components/common/Setting/model' import { useBasicLayout } from '@/hooks/useBasicLayout' import { useAuthStoreWithout, usePromptStore } from '@/store' import { rankBetween } from '@/utils/lexorank' -import PromptRecommend from '../../../assets/recommend.json' const props = defineProps() @@ -41,7 +40,6 @@ const showModal = ref(false) const ordering = ref(false) const saving = ref(false) -const importLoading = ref(false) const exportLoading = ref(false) const searchValue = ref('') @@ -53,10 +51,6 @@ const promptStore = usePromptStore() // Mobile responsiveness. const { isMobile } = useBasicLayout() -// Recommended prompt list for online import; customize via assets/recommend.json. -const promptRecommendList = PromptRecommend -// const promptList = ref([]) - const promptList = ref(promptStore.promptList) // Temporary prompt params for add/edit. @@ -88,13 +82,6 @@ function changeShowModal(mode: 'add' | 'modify' | 'local_import', selected?: Dat modalMode.value = mode } -// Online import. -const downloadURL = ref('') -const downloadDisabled = computed(() => downloadURL.value.trim().length < 1) -function setDownloadURL(url: string) { - downloadURL.value = url -} - // Control input button state. const inputStatus = computed (() => tempPromptKey.value.trim().length < 1 || tempPromptValue.value.trim().length < 1) @@ -362,35 +349,6 @@ function exportPromptTemplate() { exportLoading.value = false } -// Template online import. -async function downloadPromptTemplate() { - try { - importLoading.value = true - const response = await fetch(downloadURL.value) - const jsonData = await response.json() - if ('key' in jsonData[0] && 'value' in jsonData[0]) - tempPromptValue.value = JSON.stringify(jsonData) - if ('act' in jsonData[0] && 'prompt' in jsonData[0]) { - const newJsonData = jsonData.map((item: { act: string, prompt: string }) => { - return { - key: item.act, - value: item.prompt, - } - }) - tempPromptValue.value = JSON.stringify(newJsonData) - } - await importPromptTemplate() - downloadURL.value = '' - } - catch { - message.error(t('store.downloadError')) - downloadURL.value = '' - } - finally { - importLoading.value = false - } -} - // Mobile responsiveness. function renderTemplate() { return promptList.value.map((item: UserPrompt) => { @@ -404,14 +362,6 @@ function renderTemplate() { }) } -const pagination = computed(() => { - const [pageSize, pageSlot] = isMobile.value ? [6, 5] : [7, 15] - return { - pageSize, - pageSlot, - } -}) - const draggingId = ref(null) const isSearchActive = computed(() => searchValue.value.trim().length > 0) @@ -683,182 +633,129 @@ async function handleGetUserPromptList() {