chore: remove @memoh/shared

This commit is contained in:
Acbox
2026-02-11 14:46:50 +08:00
parent 48681ce0bb
commit ca86a8d1c3
31 changed files with 91 additions and 296 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ import vue from 'eslint-plugin-vue'
export default [ export default [
...tseslint.configs.recommended, ...tseslint.configs.recommended,
...vue.configs['flat/recommended'], ...vue.configs['flat/recommended'],
{ ignores: ['**/node_modules/**', '**/dist/**'] }, { ignores: ['**/node_modules/**', '**/dist/**', 'packages/sdk/src/**'] },
{ {
files: ['packages/**/*.{js,jsx,ts,tsx}', 'agent/**/*.{js,jsx,ts,tsx}'], files: ['packages/**/*.{js,jsx,ts,tsx}', 'agent/**/*.{js,jsx,ts,tsx}'],
languageOptions: { languageOptions: {
+2 -2
View File
@@ -16,5 +16,5 @@ export default defineConfig({
}, },
'@hey-api/client-fetch', '@hey-api/client-fetch',
'@pinia/colada', '@pinia/colada',
] ],
}); })
-1
View File
@@ -18,7 +18,6 @@
}, },
"dependencies": { "dependencies": {
"@elysiajs/eden": "^1.4.6", "@elysiajs/eden": "^1.4.6",
"@memoh/shared": "workspace:*",
"elysia": "latest", "elysia": "latest",
"commander": "^12.1.0", "commander": "^12.1.0",
"chalk": "^5.4.1", "chalk": "^5.4.1",
-1
View File
@@ -1 +0,0 @@
# @memoh/shared
-13
View File
@@ -1,13 +0,0 @@
{
"name": "@memoh/shared",
"version": "1.0.0",
"description": "",
"exports": {
".": "./src/index.ts"
},
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"packageManager": "pnpm@10.27.0"
}
-15
View File
@@ -1,15 +0,0 @@
export interface robot{
description: string
time: Date,
id: string | number,
type: string,
action: 'robot',
state:'thinking'|'generate'|'complete'
}
export interface user{
description: string,
time: Date,
id: number | string,
action:'user'
}
-5
View File
@@ -1,5 +0,0 @@
export * from './model'
export * from './schedule'
export * from './platform'
export * from './mcp'
export * from './chatInfo'
-48
View File
@@ -1,48 +0,0 @@
export interface BaseMCPConnection {
type: string
name: string
}
export interface StdioMCPConnection extends BaseMCPConnection {
type: 'stdio'
command: string
args: string[]
env: Record<string, string>
cwd: string
}
export interface BaseHTTPMCPConnection extends BaseMCPConnection {
url: string
headers: Record<string, string>
}
export interface HTTPMCPConnection extends BaseHTTPMCPConnection {
type: 'http'
}
export interface SSEMCPConnection extends BaseHTTPMCPConnection {
type: 'sse'
}
export type MCPConnection =
| StdioMCPConnection
| HTTPMCPConnection
| SSEMCPConnection
export interface MCPListItem{
id: string;
type: string;
name: string;
config: {
cwd: string;
env: Record<string, string>;
args: string[];
type: string;
command: string;
};
active: boolean;
user: string;
createdAt: string;
updatedAt: string;
}
-101
View File
@@ -1,101 +0,0 @@
export enum ModelClientType {
OPENAI = 'openai',
ANTHROPIC = 'anthropic',
GOOGLE = 'google',
}
export enum ModelType {
CHAT = 'chat',
EMBEDDING = 'embedding',
}
export interface BaseModel {
/**
* @description The unique identifier for the model
* @example 'gpt-4o'
*/
modelId: string
/**
* @description The base URL for the model
* @example 'https://api.openai.com/v1'
*/
baseUrl: string
/**
* @description The API key for the model
* @example 'sk-1234567890'
*/
apiKey: string
/**
* @description The client type for the model
* @enum {ModelClientType}
*/
clientType: ModelClientType
/**
* @description The display name for the model
* @example 'GPT 4o'
*/
name?: string
/**
* @description The model type
* @enum {ModelType}
* @default {ModelType.CHAT}
*/
type?: ModelType
}
export interface EmbeddingModel extends BaseModel {
type?: ModelType.EMBEDDING
/**
* @description The dimensions of the embedding
* @example 1536
*/
dimensions: number
}
export interface ChatModel extends BaseModel {
type?: ModelType.CHAT
}
export type Model = EmbeddingModel | ChatModel
// 表格当中model的类型
export interface ModelList {
apiKey: string,
baseUrl: string,
clientType: 'OpenAI' | 'Anthropic' | 'Google',
modelId: string,
name: string,
type: 'chat' | 'embedding',
id: string,
defaultChatModel: boolean,
defaultEmbeddingModel: boolean,
defaultSummaryModel: boolean
}
export interface ProviderInfo{
api_key: string;
base_url: string;
client_type: string;
metadata: Record<'additionalProp1',object>;
name: string;
}
export interface ModelInfo{
dimensions:number
is_multimodal:boolean
input?: string[]
llm_provider_id:string
model_id:string
name:string
type: string
enable_as?:string
}
export const clientType = ['openai', 'anthropic', 'google', 'ollama'] as const
-7
View File
@@ -1,7 +0,0 @@
export interface Platform {
id: string
name: string
// endpoint: string
config: Record<string, unknown>
active: boolean
}
-8
View File
@@ -1,8 +0,0 @@
export interface Schedule {
id?: string
pattern: string
name: string
description: string
command: string
maxCalls?: number | null
}
-44
View File
@@ -1,44 +0,0 @@
# Markdown 语法测试文档
## 1. 标题层级
### 一级标题
#### 二级标题
##### 三级标题
###### 六级标题
## 2. 文本格式
**粗体文本**
*斜体文本*
~~删除线文本~~
`代码片段`
> 引用文本
> 可以多行
## 3. 列表
### 无序列表
- 项目一
- 项目二
- 子项目
- 项目三
### 有序列表
1. 第一步
2. 第二步
3. 第三步
## 4. 链接与图片
[百度](https://www.baidu.com)
![Markdown Logo](https://markdown-here.com/img/icon256.png)
## 5. 表格
| 姓名 | 年龄 | 职业 |
|------|------|------|
| 张三 | 25 | 开发 |
| 李四 | 30 | 测试 |
## 6. 代码块
```python
def hello_world():
print("Hello, World!")
-1
View File
@@ -9,7 +9,6 @@
"start": "vite preview" "start": "vite preview"
}, },
"dependencies": { "dependencies": {
"@memoh/shared": "workspace:*",
"@memoh/ui": "workspace:*", "@memoh/ui": "workspace:*",
"@memoh/sdk": "workspace:*", "@memoh/sdk": "workspace:*",
"@pinia/colada": "^0.21.1", "@pinia/colada": "^0.21.1",
@@ -89,7 +89,7 @@
<SelectContent> <SelectContent>
<SelectGroup> <SelectGroup>
<SelectItem <SelectItem
v-for="type in clientType" v-for="type in CLIENT_TYPES"
:key="type" :key="type"
:value="type" :value="type"
> >
@@ -152,7 +152,7 @@ import {
import { toTypedSchema } from '@vee-validate/zod' import { toTypedSchema } from '@vee-validate/zod'
import z from 'zod' import z from 'zod'
import { useForm } from 'vee-validate' import { useForm } from 'vee-validate'
import { clientType } from '@memoh/shared' import { CLIENT_TYPES } from '@/composables/api/useProviders'
import { useCreateProvider } from '@/composables/api/useProviders' import { useCreateProvider } from '@/composables/api/useProviders'
const open = defineModel<boolean>('open') const open = defineModel<boolean>('open')
@@ -4,14 +4,11 @@
<FontAwesomeIcon :icon="['fas', 'robot']" /> <FontAwesomeIcon :icon="['fas', 'robot']" />
</div> </div>
<section class="w-[90%]"> <section class="w-[90%]">
<sup class="font-semibold">
{{ robotSay.type }}
</sup>
<p class="leading-7 text-muted-foreground break-all"> <p class="leading-7 text-muted-foreground break-all">
<LoadingDots v-if="robotSay.state === 'thinking'" /> <LoadingDots v-if="message.streaming && !textContent" />
<MarkdownRender <MarkdownRender
v-else v-else
:content="robotSay.description" :content="textContent"
custom-id="chat-answer" custom-id="chat-answer"
/> />
</p> </p>
@@ -20,14 +17,22 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import type { robot } from '@memoh/shared' import { computed } from 'vue'
import type { ChatMessage } from '@/store/chat-list'
import MarkdownRender, { enableKatex, enableMermaid } from 'markstream-vue' import MarkdownRender, { enableKatex, enableMermaid } from 'markstream-vue'
import LoadingDots from '@/components/loading-dots/index.vue' import LoadingDots from '@/components/loading-dots/index.vue'
enableKatex() enableKatex()
enableMermaid() enableMermaid()
defineProps<{ const props = defineProps<{
robotSay: robot message: ChatMessage
}>() }>()
const textContent = computed(() => {
return props.message.blocks
.filter(b => b.type === 'text')
.map(b => b.type === 'text' ? b.content : '')
.join('')
})
</script> </script>
+12 -11
View File
@@ -4,16 +4,16 @@
class="flex flex-col gap-4" class="flex flex-col gap-4"
> >
<template <template
v-for="chatItem in chatList" v-for="chatItem in messages"
:key="chatItem.id" :key="chatItem.id"
> >
<UserChat <UserChat
v-if="chatItem.action === 'user'" v-if="chatItem.role === 'user'"
:user-say="chatItem" :message="chatItem"
/> />
<RobotChat <AssistantChat
v-if="chatItem.action === 'robot'" v-if="chatItem.role === 'assistant'"
:robot-say="chatItem" :message="chatItem"
/> />
</template> </template>
</div> </div>
@@ -21,14 +21,15 @@
<script setup lang="ts"> <script setup lang="ts">
import UserChat from './user-chat/index.vue' import UserChat from './user-chat/index.vue'
import RobotChat from './robot-chat/index.vue' import AssistantChat from './assistant-chat/index.vue'
import { inject, ref, watch } from 'vue' import { inject, ref, watch } from 'vue'
import { useChatList } from '@/store/chat-list' import { useChatStore } from '@/store/chat-list'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
import { useAutoScroll } from '@/composables/useAutoScroll' import { useAutoScroll } from '@/composables/useAutoScroll'
const { chatList, sendMessage } = useChatList() const store = useChatStore()
const { loading } = storeToRefs(useChatList()) const { messages, sendMessage } = store
const { streaming } = storeToRefs(store)
// ---- 消息发送 ---- // ---- 消息发送 ----
const chatSay = inject('chatSay', ref('')) const chatSay = inject('chatSay', ref(''))
@@ -47,5 +48,5 @@ watch(chatSay, async () => {
// ---- 自动滚动 ---- // ---- 自动滚动 ----
const displayContainer = ref<HTMLElement>() const displayContainer = ref<HTMLElement>()
useAutoScroll(displayContainer, loading) useAutoScroll(displayContainer, streaming)
</script> </script>
@@ -4,14 +4,21 @@
class="leading-7 not-first:mt-6 max-w-[90%] ml-auto text-muted-foreground bg-[#F9F9F9] p-4 rounded-xl rounded-tr-none break-all dark:bg-[#1C1917] class="leading-7 not-first:mt-6 max-w-[90%] ml-auto text-muted-foreground bg-[#F9F9F9] p-4 rounded-xl rounded-tr-none break-all dark:bg-[#1C1917]
" "
> >
{{ userSay.description }} {{ textContent }}
</p> </p>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import type { user } from '@memoh/shared' import { computed } from 'vue'
const { userSay } = defineProps<{ import type { ChatMessage } from '@/store/chat-list'
userSay: user
const props = defineProps<{
message: ChatMessage
}>() }>()
</script>
const textContent = computed(() => {
const block = props.message.blocks.find(b => b.type === 'text')
return block?.type === 'text' ? block.content : ''
})
</script>
@@ -260,7 +260,7 @@ import z from 'zod'
import { toTypedSchema } from '@vee-validate/zod' import { toTypedSchema } from '@vee-validate/zod'
import { useForm } from 'vee-validate' import { useForm } from 'vee-validate'
import { ref, inject, watch } from 'vue' import { ref, inject, watch } from 'vue'
import { type MCPListItem as MCPType } from '@memoh/shared' import { type MCPListItem as MCPType } from '@/composables/api/useMcp'
import { useKeyValueTags } from '@/composables/useKeyValueTags' import { useKeyValueTags } from '@/composables/useKeyValueTags'
import { useCreateOrUpdateMcp } from '@/composables/api/useMcp' import { useCreateOrUpdateMcp } from '@/composables/api/useMcp'
@@ -172,7 +172,7 @@ import { useForm } from 'vee-validate'
import { inject, computed, watch, nextTick, type Ref, ref } from 'vue' import { inject, computed, watch, nextTick, type Ref, ref } from 'vue'
import { toTypedSchema } from '@vee-validate/zod' import { toTypedSchema } from '@vee-validate/zod'
import z from 'zod' import z from 'zod'
import { type ModelInfo } from '@memoh/shared' import { type ModelInfo } from '@/composables/api/useModels'
import { useCreateModel, useUpdateModel } from '@/composables/api/useModels' import { useCreateModel, useUpdateModel } from '@/composables/api/useModels'
const formSchema = toTypedSchema(z.object({ const formSchema = toTypedSchema(z.object({
+17 -2
View File
@@ -1,9 +1,24 @@
import { fetchApi } from '@/utils/request' import { fetchApi } from '@/utils/request'
import { useQuery, useMutation, useQueryCache } from '@pinia/colada' import { useQuery, useMutation, useQueryCache } from '@pinia/colada'
import { type MCPListItem } from '@memoh/shared'
// ---- Types ---- // ---- Types ----
export interface MCPListItem {
id: string
type: string
name: string
config: {
cwd: string
env: Record<string, string>
args: string[]
type: string
command: string
}
active: boolean
user: string
createdAt: string
updatedAt: string
}
export interface McpListResponse { export interface McpListResponse {
items: MCPListItem[] items: MCPListItem[]
} }
+11 -1
View File
@@ -1,10 +1,20 @@
import { fetchApi } from '@/utils/request' import { fetchApi } from '@/utils/request'
import { useQuery, useMutation, useQueryCache } from '@pinia/colada' import { useQuery, useMutation, useQueryCache } from '@pinia/colada'
import { type ModelInfo } from '@memoh/shared'
import type { Ref } from 'vue' import type { Ref } from 'vue'
// ---- Types ---- // ---- Types ----
export interface ModelInfo {
dimensions: number
is_multimodal: boolean
input?: string[]
llm_provider_id: string
model_id: string
name: string
type: string
enable_as?: string
}
export interface CreateModelRequest { export interface CreateModelRequest {
model_id: string model_id: string
type: string type: string
@@ -1,10 +1,19 @@
import { fetchApi } from '@/utils/request' import { fetchApi } from '@/utils/request'
import { useQuery, useMutation, useQueryCache } from '@pinia/colada' import { useQuery, useMutation, useQueryCache } from '@pinia/colada'
import { type ProviderInfo } from '@memoh/shared'
import type { Ref } from 'vue' import type { Ref } from 'vue'
// ---- Types ---- // ---- Types ----
export interface ProviderInfo {
api_key: string
base_url: string
client_type: string
metadata: Record<'additionalProp1', object>
name: string
}
export const CLIENT_TYPES = ['openai', 'anthropic', 'google', 'ollama'] as const
export type ProviderWithId = ProviderInfo & { id: string } export type ProviderWithId = ProviderInfo & { id: string }
export interface CreateProviderRequest { export interface CreateProviderRequest {
@@ -89,7 +89,7 @@ import {
ScrollArea, ScrollArea,
} from '@memoh/ui' } from '@memoh/ui'
import { computed, ref, watch } from 'vue' import { computed, ref, watch } from 'vue'
import type { ModelInfo } from '@memoh/shared' import type { ModelInfo } from '@/composables/api/useModels'
import type { ProviderWithId } from '@/composables/api/useProviders' import type { ProviderWithId } from '@/composables/api/useProviders'
const props = defineProps<{ const props = defineProps<{
+1 -1
View File
@@ -17,7 +17,7 @@ import {
Badge, Badge,
Button Button
} from '@memoh/ui' } from '@memoh/ui'
import { type MCPListItem as MCPType } from '@memoh/shared' import { type MCPListItem as MCPType } from '@/composables/api/useMcp'
import { i18nRef } from '@/i18n' import { i18nRef } from '@/i18n'
import { useMcpList, useDeleteMcp } from '@/composables/api/useMcp' import { useMcpList, useDeleteMcp } from '@/composables/api/useMcp'
@@ -43,7 +43,7 @@ import {
Button, Button,
} from '@memoh/ui' } from '@memoh/ui'
import ConfirmPopover from '@/components/confirm-popover/index.vue' import ConfirmPopover from '@/components/confirm-popover/index.vue'
import { type ModelInfo } from '@memoh/shared' import { type ModelInfo } from '@/composables/api/useModels'
defineProps<{ defineProps<{
model: ModelInfo model: ModelInfo
@@ -51,7 +51,7 @@ import {
} from '@memoh/ui' } from '@memoh/ui'
import CreateModel from '@/components/create-model/index.vue' import CreateModel from '@/components/create-model/index.vue'
import ModelItem from './model-item.vue' import ModelItem from './model-item.vue'
import { type ModelInfo } from '@memoh/shared' import { type ModelInfo } from '@/composables/api/useModels'
defineProps<{ defineProps<{
providerId: string | undefined providerId: string | undefined
@@ -100,7 +100,7 @@ import { computed, watch } from 'vue'
import { toTypedSchema } from '@vee-validate/zod' import { toTypedSchema } from '@vee-validate/zod'
import z from 'zod' import z from 'zod'
import { useForm } from 'vee-validate' import { useForm } from 'vee-validate'
import { type ProviderInfo } from '@memoh/shared' import { type ProviderInfo } from '@/composables/api/useProviders'
const props = defineProps<{ const props = defineProps<{
provider: Partial<ProviderInfo & { id: string }> | undefined provider: Partial<ProviderInfo & { id: string }> | undefined
+2 -3
View File
@@ -28,9 +28,8 @@ import {
EmptyMedia, EmptyMedia,
EmptyTitle, EmptyTitle,
} from '@memoh/ui' } from '@memoh/ui'
import { type ProviderInfo } from '@memoh/shared' import { type ProviderInfo, CLIENT_TYPES } from '@/composables/api/useProviders'
import AddProvider from '@/components/add-provider/index.vue' import AddProvider from '@/components/add-provider/index.vue'
import { clientType } from '@memoh/shared'
import { useProviderList } from '@/composables/api/useProviders' import { useProviderList } from '@/composables/api/useProviders'
const filterProvider = ref('') const filterProvider = ref('')
@@ -141,7 +140,7 @@ const openStatus = reactive({
<SelectContent> <SelectContent>
<SelectGroup> <SelectGroup>
<SelectItem <SelectItem
v-for="type in clientType" v-for="type in CLIENT_TYPES"
:key="type" :key="type"
:value="type" :value="type"
> >
@@ -32,7 +32,8 @@ import { Separator } from '@memoh/ui'
import ProviderForm from './components/provider-form.vue' import ProviderForm from './components/provider-form.vue'
import ModelList from './components/model-list.vue' import ModelList from './components/model-list.vue'
import { computed, inject, provide, reactive, ref, toRef, watch } from 'vue' import { computed, inject, provide, reactive, ref, toRef, watch } from 'vue'
import { type ProviderInfo, type ModelInfo } from '@memoh/shared' import { type ModelInfo } from '@/composables/api/useModels'
import { type ProviderInfo } from '@/composables/api/useProviders'
import { import {
useUpdateProvider, useUpdateProvider,
useDeleteProvider, useDeleteProvider,
View File
-8
View File
@@ -109,9 +109,6 @@ importers:
'@elysiajs/eden': '@elysiajs/eden':
specifier: ^1.4.6 specifier: ^1.4.6
version: 1.4.6(elysia@1.4.22(@sinclair/typebox@0.34.47)(@types/bun@1.3.8)(exact-mirror@0.2.6(@sinclair/typebox@0.34.47))(file-type@21.3.0)(openapi-types@12.1.3)(typescript@5.9.3)) version: 1.4.6(elysia@1.4.22(@sinclair/typebox@0.34.47)(@types/bun@1.3.8)(exact-mirror@0.2.6(@sinclair/typebox@0.34.47))(file-type@21.3.0)(openapi-types@12.1.3)(typescript@5.9.3))
'@memoh/shared':
specifier: workspace:*
version: link:../shared
chalk: chalk:
specifier: ^5.4.1 specifier: ^5.4.1
version: 5.6.2 version: 5.6.2
@@ -149,8 +146,6 @@ importers:
packages/sdk: {} packages/sdk: {}
packages/shared: {}
packages/ui: packages/ui:
dependencies: dependencies:
'@tailwindcss/vite': '@tailwindcss/vite':
@@ -259,9 +254,6 @@ importers:
'@memoh/sdk': '@memoh/sdk':
specifier: workspace:* specifier: workspace:*
version: link:../sdk version: link:../sdk
'@memoh/shared':
specifier: workspace:*
version: link:../shared
'@memoh/ui': '@memoh/ui':
specifier: workspace:* specifier: workspace:*
version: link:../ui version: link:../ui