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. 22
      src/views/role/index.vue

4
src/api/base/message.ts

@ -40,9 +40,9 @@ export async function removeMessage(ids: string) {
/** /**
* @description * @description
*/ */
export async function conversationList(type: number) { export async function conversationList(menuType: number) {
return defHttp.get({ 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 { interface RoleInfoAppModel {
id: number id: string
roleName: string roleName: string
roleType: string roleType: string
roleInfo: string roleInfo: string

22
src/views/role/index.vue

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

Loading…
Cancel
Save