Skip to content

Commit

Permalink
feat: modify review
Browse files Browse the repository at this point in the history
  • Loading branch information
xuanlid committed Feb 27, 2025
1 parent db10ac4 commit 75728cc
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 28 deletions.
21 changes: 11 additions & 10 deletions packages/plugins/robot/src/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
<robotSettingPopover
v-if="showPopover"
:typeValue="selectedModel"
@changeType="changeModel"
:tokenValue="tokenValue"
@active="activeSetting('props')"
@changeType="changeModel"
@close="closePanel"
></robotSettingPopover>
<template #reference>
<span class="chat-title-dropdown" @click.stop="showPopover = true">
Expand Down Expand Up @@ -114,19 +114,19 @@

<script>
import { ref, onMounted, watchEffect } from 'vue'
import { Layout, Row, Col, Button, Input, Notify, Loading, Popover as TinyPopover } from '@opentiny/vue'
import { TinyLayout, TinyRow, TinyCol, TinyButton, TinyInput, Notify, Loading, TinyPopover } from '@opentiny/vue'
import { useCanvas, useHistory, usePage, useModal, getMetaApi, META_SERVICE } from '@opentiny/tiny-engine-meta-register'
import { extend } from '@opentiny/vue-renderless/common/object'
import robotSettingPopover from './robotSettingPopover.vue'
import { getBlockContent, initBlockList, AIModelOptions } from './js/robotSetting'
export default {
components: {
TinyLayout: Layout,
TinyButton: Button,
TinyRow: Row,
TinyCol: Col,
TinyInput: Input,
TinyLayout,
TinyButton,
TinyRow,
TinyCol,
TinyInput,
TinyPopover,
robotSettingPopover
},
Expand Down Expand Up @@ -260,6 +260,7 @@ export default {
const resizeChatWindow = async () => {
chatWindowOpened.value = !chatWindowOpened.value
showPopover.value = showPopover.value && !showPopover.value
await resetContent()
}
Expand Down Expand Up @@ -382,7 +383,7 @@ export default {
robotVisible.value = !robotVisible.value
}
const activeSetting = () => {
const closePanel = () => {
showPopover.value = false
}
Expand All @@ -401,7 +402,7 @@ export default {
selectedModel,
changeModel,
openAIRobot,
activeSetting,
closePanel,
tokenValue,
showPopover
}
Expand Down
33 changes: 15 additions & 18 deletions packages/plugins/robot/src/robotSettingPopover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
<div class="header">设置</div>
<tiny-form ref="robotSettingForm" label-position="top" :rules="formRules" :model="formData" validate-type="text">
<tiny-form-item prop="type" label="大模型类型" label-width="150px">
<tiny-select v-model="formData.type" placeholder="请选择" @change="changeModelType">
<tiny-option v-for="item in AIModelOptions" :key="item.label" :label="item.label" :value="item.value">
</tiny-option>
</tiny-select>
<tiny-select
v-model="formData.type"
:options="AIModelOptions"
placeholder="请选择"
@change="changeModelType"
></tiny-select>
</tiny-form-item>
<tiny-form-item prop="tokenVal" label-width="150px">
<template #label>
Expand All @@ -26,18 +28,17 @@
</template>
<script>
import { ref, reactive } from 'vue'
import { Form, FormItem, Input, Button, Select, Option, Tooltip } from '@opentiny/vue'
import { TinyForm, TinyFormItem, TinyInput, TinyButton, TinySelect, TinyTooltip } from '@opentiny/vue'
import { AIModelOptions } from './js/robotSetting'
export default {
components: {
TinyForm: Form,
TinyFormItem: FormItem,
TinyInput: Input,
TinyButton: Button,
TinySelect: Select,
TinyOption: Option,
TinyTooltip: Tooltip
TinyForm,
TinyFormItem,
TinyInput,
TinyButton,
TinySelect,
TinyTooltip
},
props: {
typeValue: {
Expand All @@ -58,14 +59,11 @@ export default {
})
const formRules = {
type: [{ required: true, message: '必选', trigger: 'change' }],
tokenVal: [{ required: true, message: '必填', trigger: 'blur' }]
type: [{ required: true, message: '必选', trigger: 'change' }]
}
const active = ref('props')
const closePanel = () => {
emit('active', 'props')
emit('close')
}
const changeModelType = () => {
Expand All @@ -83,7 +81,6 @@ export default {
}
return {
active,
confirm,
closePanel,
robotSettingForm,
Expand Down

0 comments on commit 75728cc

Please sign in to comment.