@opentiny/tiny-robot-cli 0.4.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +21 -0
- package/bin/cli.js +26 -0
- package/bin/commands/add.js +436 -0
- package/bin/commands/create.js +144 -0
- package/bin/utils.js +337 -0
- package/package.json +28 -0
- package/templates/basic/.env.example +2 -0
- package/templates/basic/README.md +45 -0
- package/templates/basic/index.html +13 -0
- package/templates/basic/package.json +29 -0
- package/templates/basic/public/favicon.ico +0 -0
- package/templates/basic/public/modelcontextprotocol.png +0 -0
- package/templates/basic/src/App.vue +130 -0
- package/templates/basic/src/components/ChatList.vue +82 -0
- package/templates/basic/src/components/ChatSender.vue +125 -0
- package/templates/basic/src/components/ConversationHistory.vue +136 -0
- package/templates/basic/src/components/HistoryDrawerButton.vue +43 -0
- package/templates/basic/src/components/McpServerPickerButton.vue +278 -0
- package/templates/basic/src/components/ThemeToggleButton.vue +44 -0
- package/templates/basic/src/components/icons/IconDeepThink.vue +29 -0
- package/templates/basic/src/components/icons/IconModelAliyunBailian.vue +51 -0
- package/templates/basic/src/components/icons/IconModelDeepseek.vue +29 -0
- package/templates/basic/src/components/icons/IconMoon.vue +29 -0
- package/templates/basic/src/components/icons/IconPlugin.vue +29 -0
- package/templates/basic/src/components/icons/IconSun.vue +35 -0
- package/templates/basic/src/components/icons/IconWebSearch.vue +36 -0
- package/templates/basic/src/components/icons/index.ts +7 -0
- package/templates/basic/src/composables/useChat.ts +129 -0
- package/templates/basic/src/composables/useMcp.ts +170 -0
- package/templates/basic/src/composables/useModel.ts +82 -0
- package/templates/basic/src/main.ts +7 -0
- package/templates/basic/src/mcpServers.ts +40 -0
- package/templates/basic/src/models.ts +81 -0
- package/templates/basic/src/style.css +21 -0
- package/templates/basic/tsconfig.app.json +16 -0
- package/templates/basic/tsconfig.json +7 -0
- package/templates/basic/tsconfig.node.json +26 -0
- package/templates/basic/vite.config.ts +16 -0
- package/templates/chat/.env.example +1 -0
- package/templates/chat/src/TinyRobotChat.vue +35 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { type Component } from 'vue'
|
|
2
|
+
import { IconModelAliyunBailian, IconModelDeepseek } from './components/icons'
|
|
3
|
+
|
|
4
|
+
export interface ModelCapabilities {
|
|
5
|
+
thinking?: Record<string, unknown> | false
|
|
6
|
+
search?: Record<string, unknown> | false
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface ModelConfigItem {
|
|
10
|
+
name: string
|
|
11
|
+
model: string
|
|
12
|
+
capabilities?: ModelCapabilities
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ProviderModelConfig {
|
|
16
|
+
apiUrl: string
|
|
17
|
+
icon: Component
|
|
18
|
+
apiKey?: string
|
|
19
|
+
models: ModelConfigItem[]
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const ModelConfigs: Record<string, ProviderModelConfig> = {
|
|
23
|
+
aliyun: {
|
|
24
|
+
apiUrl: 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
|
|
25
|
+
icon: IconModelAliyunBailian,
|
|
26
|
+
apiKey: import.meta.env.VITE_ALIYUN_DASHSCOPE_KEY,
|
|
27
|
+
models: [
|
|
28
|
+
{
|
|
29
|
+
name: 'Qwen Flash',
|
|
30
|
+
model: 'qwen-flash',
|
|
31
|
+
capabilities: {
|
|
32
|
+
thinking: {
|
|
33
|
+
enable_thinking: true,
|
|
34
|
+
},
|
|
35
|
+
search: {
|
|
36
|
+
enable_search: true,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'Qwen Plus',
|
|
42
|
+
model: 'qwen-plus',
|
|
43
|
+
capabilities: {
|
|
44
|
+
thinking: {
|
|
45
|
+
enable_thinking: true,
|
|
46
|
+
},
|
|
47
|
+
search: {
|
|
48
|
+
enable_search: true,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'Qwen Max',
|
|
54
|
+
model: 'qwen-max',
|
|
55
|
+
capabilities: {
|
|
56
|
+
thinking: {
|
|
57
|
+
enable_thinking: true,
|
|
58
|
+
},
|
|
59
|
+
search: {
|
|
60
|
+
enable_search: true,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
deepseek: {
|
|
67
|
+
apiUrl: 'https://api.deepseek.com/v1',
|
|
68
|
+
icon: IconModelDeepseek,
|
|
69
|
+
apiKey: import.meta.env.VITE_DEEPSEEK_API_KEY,
|
|
70
|
+
models: [
|
|
71
|
+
{
|
|
72
|
+
name: 'DeepSeek Chat',
|
|
73
|
+
model: 'deepseek-chat',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: 'DeepSeek Reasoner',
|
|
77
|
+
model: 'deepseek-reasoner',
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
font-family:
|
|
3
|
+
Inter,
|
|
4
|
+
-apple-system,
|
|
5
|
+
BlinkMacSystemFont,
|
|
6
|
+
'Segoe UI',
|
|
7
|
+
sans-serif;
|
|
8
|
+
color: var(--tr-text-primary);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
* {
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
body {
|
|
16
|
+
margin: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
#app {
|
|
20
|
+
height: 100vh;
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
5
|
+
"types": ["vite/client"],
|
|
6
|
+
|
|
7
|
+
/* Linting */
|
|
8
|
+
"strict": true,
|
|
9
|
+
"noUnusedLocals": true,
|
|
10
|
+
"noUnusedParameters": true,
|
|
11
|
+
"erasableSyntaxOnly": true,
|
|
12
|
+
"noFallthroughCasesInSwitch": true,
|
|
13
|
+
"noUncheckedSideEffectImports": true
|
|
14
|
+
},
|
|
15
|
+
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
|
|
16
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
4
|
+
"target": "ES2023",
|
|
5
|
+
"lib": ["ES2023"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"types": ["node"],
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
|
|
10
|
+
/* Bundler mode */
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"allowImportingTsExtensions": true,
|
|
13
|
+
"verbatimModuleSyntax": true,
|
|
14
|
+
"moduleDetection": "force",
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
|
|
17
|
+
/* Linting */
|
|
18
|
+
"strict": true,
|
|
19
|
+
"noUnusedLocals": true,
|
|
20
|
+
"noUnusedParameters": true,
|
|
21
|
+
"erasableSyntaxOnly": true,
|
|
22
|
+
"noFallthroughCasesInSwitch": true,
|
|
23
|
+
"noUncheckedSideEffectImports": true
|
|
24
|
+
},
|
|
25
|
+
"include": ["vite.config.ts"]
|
|
26
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import vue from '@vitejs/plugin-vue'
|
|
3
|
+
|
|
4
|
+
// https://vite.dev/config/
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
plugins: [vue()],
|
|
7
|
+
server: {
|
|
8
|
+
proxy: {
|
|
9
|
+
'/modelcontextprotocol-mcp': {
|
|
10
|
+
target: 'https://modelcontextprotocol.io/mcp',
|
|
11
|
+
changeOrigin: true,
|
|
12
|
+
rewrite: (path) => path.replace(/^\/modelcontextprotocol-mcp/, ''),
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VITE_DEEPSEEK_API_KEY=
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ChatMcpServerConfig, ChatModelOption } from '@opentiny/tiny-robot/experimental'
|
|
3
|
+
import { TrThemeProvider } from '@opentiny/tiny-robot'
|
|
4
|
+
import { TrChat } from '@opentiny/tiny-robot/experimental'
|
|
5
|
+
import { ref } from 'vue'
|
|
6
|
+
|
|
7
|
+
const show = ref(false)
|
|
8
|
+
const fullscreen = ref(false)
|
|
9
|
+
|
|
10
|
+
const chatModelOptions: ChatModelOption[] = [
|
|
11
|
+
{
|
|
12
|
+
id: 'deepseek-chat',
|
|
13
|
+
provider: 'deepseek',
|
|
14
|
+
name: 'DeepSeek Chat',
|
|
15
|
+
model: 'deepseek-chat',
|
|
16
|
+
apiUrl: 'https://api.deepseek.com/chat/completions',
|
|
17
|
+
apiKey: import.meta.env.VITE_DEEPSEEK_API_KEY || '',
|
|
18
|
+
},
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
const chatMcpServers: Record<string, ChatMcpServerConfig> = {}
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<TrThemeProvider>
|
|
26
|
+
<TrChat
|
|
27
|
+
v-model:show="show"
|
|
28
|
+
v-model:fullscreen="fullscreen"
|
|
29
|
+
title="TrChat Preview"
|
|
30
|
+
system-prompt="You are a helpful assistant."
|
|
31
|
+
:model-options="chatModelOptions"
|
|
32
|
+
:mcp-servers="chatMcpServers"
|
|
33
|
+
/>
|
|
34
|
+
</TrThemeProvider>
|
|
35
|
+
</template>
|