Skip to content

Commit 218df23

Browse files
committed
feat: add option customCompatibleAIModels
1 parent 6117c6c commit 218df23

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

packages/plugins/robot/src/Main.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ import { TrContainer, TrWelcome, TrPrompts, TrBubbleList, TrSender, TrBubbleProv
8080
import type { BubbleRoleConfig, PromptProps } from '@opentiny/tiny-robot'
8181
import { IconNewSession } from '@opentiny/tiny-robot-svgs'
8282
import RobotSettingPopover from './RobotSettingPopover.vue'
83-
import { getBlockContent, initBlockList, AIModelOptions } from './js/robotSetting'
83+
import { getBlockContent, initBlockList, getAIModelOptions } from './js/robotSetting'
8484
import McpServer from './mcp/McpServer.vue'
8585
import useMcpServer from './mcp/useMcp'
8686
import MarkdownRenderer from './mcp/MarkdownRenderer.vue'
@@ -102,6 +102,7 @@ export default {
102102
emits: ['close-chat'],
103103
setup() {
104104
const { initData, isBlock, isSaved, clearCurrentState } = useCanvas()
105+
const AIModelOptions = getAIModelOptions()
105106
const robotVisible = ref(false)
106107
const avatarUrl = ref('')
107108
const chatWindowOpened = ref(true)

packages/plugins/robot/src/RobotSettingPopover.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
/* metaService: engine.plugins.robot.RobotSettingPopover */
3131
import { ref, reactive } from 'vue'
3232
import { TinyForm, TinyFormItem, TinyInput, TinyButton, TinySelect, TinyTooltip } from '@opentiny/vue'
33-
import { AIModelOptions } from './js/robotSetting'
33+
import { getAIModelOptions } from './js/robotSetting'
3434
3535
export default {
3636
components: {
@@ -52,6 +52,7 @@ export default {
5252
}
5353
},
5454
setup(props, { emit }) {
55+
const AIModelOptions = getAIModelOptions()
5556
const robotSettingForm = ref(null)
5657
5758
const formData = reactive({

packages/plugins/robot/src/js/robotSetting.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@
1212

1313
/* metaService: engine.plugins.robot.js-robotSetting */
1414
import { reactive } from 'vue'
15-
import { getMetaApi, META_SERVICE } from '@opentiny/tiny-engine-meta-register'
15+
import { getOptions, getMetaApi, META_SERVICE } from '@opentiny/tiny-engine-meta-register'
16+
import meta from '../../meta'
1617

17-
export const AIModelOptions = [
18-
{ label: 'SiliconFlow:DeepSeek-V3', value: 'deepseek-ai/DeepSeek-V3', manufacturer: 'siliconflow' },
19-
{ label: 'DeepSeek:DeepSeek-V3', value: 'deepseek-chat', manufacturer: 'deepseek' }
20-
]
18+
const DEFAULT_MODELS = [{ label: 'DeepSeek:DeepSeek-V3', value: 'deepseek-chat', manufacturer: 'deepseek' }]
19+
20+
export const getAIModelOptions = () => {
21+
const aiRobotOptions = getOptions(meta.id)?.customCompatibleAIModels || []
22+
return [...DEFAULT_MODELS, ...aiRobotOptions]
23+
}
2124

2225
// 这里存放的是aichat的响应式数据
2326
const state = reactive({

0 commit comments

Comments
 (0)