Browse Source

fix:修改角色modelTyoe字段;

dxj
李朋徽 1 year ago
parent
commit
5375d44452
  1. 4
      src/api/base/message.ts
  2. 2
      src/components/AppRoleDefault/index.d.ts
  3. 14
      src/views/role/index.vue

4
src/api/base/message.ts

@ -40,9 +40,9 @@ export async function removeMessage(ids: string) {
/**
* @description
*/
export async function conversationList(type: number) {
export async function conversationList(menuType: number) {
return defHttp.get({
url: `/open-chat/chat/conversation/list?type=${type}`,
url: `/open-chat/chat/conversation/list?type=${menuType}`,
})
}

2
src/components/AppRoleDefault/index.d.ts vendored

@ -9,7 +9,7 @@ export interface RoleData {
}
interface RoleInfoAppModel {
id: number
id: string
roleName: string
roleType: string
roleInfo: string

14
src/views/role/index.vue

@ -129,12 +129,16 @@ async function handleSubMenuChange(index: number, item?: SubMenuItem) {
historyMessageParams.value.total = 0
messageStore.setConversationData(subMenuList.value[subMenuActiveIndex.value])
messageStore.setMessageClear()
const modelIdx = modelOptions.findIndex(v => v.value === Number(subMenuList.value[subMenuActiveIndex.value].modelType))
if (subMenuActiveIndex.value !== -1) {
const modelIdx = modelOptions.findIndex((v) => {
return v.value === Number(subMenuList.value[subMenuActiveIndex.value].modelType)
})
if (modelIdx === -1) {
message.warn('未找到该对话下的模型信息')
return
}
modelIndex.value = modelIdx
}
useMqtt().end()
useMqtt().connect()
@ -324,9 +328,9 @@ async function handleRole(item: RoleData) {
* @description: 选择应用
*/
async function handleApply(item: RoleInfoAppModel) {
const obj = subMenuList.value.find(v => v.roleId === item.id)
const obj = subMenuList.value.find(v => String(v.roleId) === item.id)
if (obj) {
const index = subMenuList.value.findIndex(v => v.roleId === item.id)
const index = subMenuList.value.findIndex(v => String(v.roleId) === item.id)
await handleSubMenuChange(index)
getHistoryMessage()
}
@ -334,13 +338,13 @@ async function handleApply(item: RoleInfoAppModel) {
await addMessage({
type: MenuTypeEnum.ROLE,
title: item.roleName,
roleId: String(item.id),
roleId: item.id,
sort: subMenuList.value.length + 1,
modelType: item.modelType ? item.modelType : ModelTypeEnum.GPT3,
})
await getConversationList()
await nextTick()
const index = subMenuList.value.findIndex(v => v.roleId === item.id)
const index = subMenuList.value.findIndex(v => String(v.roleId) === item.id)
subMenuActiveIndex.value = index
await handleSubMenuChange(index)
getHistoryMessage()

Loading…
Cancel
Save