diff --git a/src/assets/recommend.json b/src/assets/recommend.json new file mode 100644 index 0000000..33786e1 --- /dev/null +++ b/src/assets/recommend.json @@ -0,0 +1,8 @@ +[ + { + "key": "awesome-chatgpt-prompts-zh", + "desc": "ChatGPT 中文调教指南", + "downloadUrl": "https://raw.githubusercontent.com/Nothing1024/chatgpt-prompt-collection/main/awesome-chatgpt-prompts-zh.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 new file mode 100644 index 0000000..97b5675 --- /dev/null +++ b/src/components/common/PromptStore/index.vue @@ -0,0 +1,429 @@ + + + diff --git a/src/components/common/index.ts b/src/components/common/index.ts index 16b6d10..d8f03ec 100644 --- a/src/components/common/index.ts +++ b/src/components/common/index.ts @@ -3,5 +3,6 @@ import NaiveProvider from './NaiveProvider/index.vue' import SvgIcon from './SvgIcon/index.vue' import UserAvatar from './UserAvatar/index.vue' import Setting from './Setting/index.vue' +import PromptStore from './PromptStore/index.vue' -export { HoverButton, NaiveProvider, SvgIcon, UserAvatar, Setting } +export { HoverButton, NaiveProvider, SvgIcon, UserAvatar, Setting, PromptStore } diff --git a/src/store/modules/index.ts b/src/store/modules/index.ts index b33b51b..74e4825 100644 --- a/src/store/modules/index.ts +++ b/src/store/modules/index.ts @@ -1,4 +1,5 @@ export * from './app' export * from './chat' export * from './user' +export * from './prompt' export * from './auth' diff --git a/src/store/modules/prompt/helper.ts b/src/store/modules/prompt/helper.ts new file mode 100644 index 0000000..6b21c2b --- /dev/null +++ b/src/store/modules/prompt/helper.ts @@ -0,0 +1,18 @@ +import { ss } from '@/utils/storage' + +const LOCAL_NAME = 'promptStore' + +export type PromptList = [] + +export interface PromptStore { + promptList: PromptList +} + +export function getLocalPromptList(): PromptStore { + const promptStore: PromptStore | undefined = ss.get(LOCAL_NAME) + return promptStore ?? { promptList: [] } +} + +export function setLocalPromptList(promptStore: PromptStore): void { + ss.set(LOCAL_NAME, promptStore) +} diff --git a/src/store/modules/prompt/index.ts b/src/store/modules/prompt/index.ts new file mode 100644 index 0000000..2365ecd --- /dev/null +++ b/src/store/modules/prompt/index.ts @@ -0,0 +1,17 @@ +import { defineStore } from 'pinia' +import type { PromptStore } from './helper' +import { getLocalPromptList, setLocalPromptList } from './helper' + +export const usePromptStore = defineStore('prompt-store', { + state: (): PromptStore => getLocalPromptList(), + + actions: { + updatePromptList(promptList: []) { + this.$patch({ promptList }) + setLocalPromptList({ promptList }) + }, + getPromptList() { + return this.$state + }, + }, +}) diff --git a/src/views/chat/index.vue b/src/views/chat/index.vue index f18cd4b..92ecd58 100644 --- a/src/views/chat/index.vue +++ b/src/views/chat/index.vue @@ -1,7 +1,8 @@