Browse Source

fix:1. 新建会话时,列表选中方式改为使用id获取;2. 会话列表增加副标题;3. 角色与应用新增是增加contextCount字段;

dxj
李朋徽 1 year ago
parent
commit
cda01c1220
  1. 1
      src/api/base/message.ts
  2. 2
      src/components/AppRoleDefault/index.d.ts
  3. 3
      src/components/AppRoleDefault/index.vue
  4. 2
      src/components/AppSubMenuList/index.vue
  5. 3
      src/store/moules/messageStore/index.d.ts
  6. 4
      src/views/conversation/index.vue
  7. 4
      src/views/conversationNet/index.vue
  8. 4
      src/views/repository/index.vue
  9. 17
      src/views/role/index.vue
  10. 4
      src/views/textToImage/index.vue
  11. 4
      src/views/visualAnalysis/index.vue

1
src/api/base/message.ts

@ -11,6 +11,7 @@ export async function addMessage(data: {
sort: number
roleId?: string
modelType: ModelTypeEnum
contextCount?: number | null // 携带上下文数量
}) {
return defHttp.post({
url: `/open-chat/chat/conversation/save`,

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

@ -6,6 +6,7 @@ export interface RoleData {
remark: string
type: number
modelType: number
contextCount: number | null
}
interface RoleInfoAppModel {
@ -16,6 +17,7 @@ interface RoleInfoAppModel {
roleImg: string
type: number
modelType: number
contextCount: number | null
}
export interface AppGroup {

3
src/components/AppRoleDefault/index.vue

@ -13,6 +13,8 @@ const typeIndex = ref(0)
//
function getRoleData() {
getRole(1).then((res) => {
console.log('角色', res)
roleList.value = res
})
}
@ -20,6 +22,7 @@ getRoleData()
//
function getAppData() {
getAppList().then((res) => {
console.log('应用', res)
application.value = res
})
}

2
src/components/AppSubMenuList/index.vue

@ -79,7 +79,7 @@ function handleBlur(index: number, item: SubMenuItem, inputValue?: string) {
{{ item.title }}
</p>
<p class="content truncate">
{{ item.content }}
{{ item.firstMsg }}
</p>
<div class="actions absolute">
<SvgIcon

3
src/store/moules/messageStore/index.d.ts vendored

@ -17,9 +17,10 @@ export interface ConversationData {
updateTime: string
updateUser: string
userId: string
content: string
actionType: SubMenuActionEnum
modelType: string
contextCount: number | null // 上下文数量
firstMsg: string
}
export interface MessageStoreType {

4
src/views/conversation/index.vue

@ -156,10 +156,10 @@ async function handleSend(value: string) {
try {
spinning.value = true
messageStore.setMessageClear()
await addMessage({ type: MenuTypeEnum.TEXT_TO_TEXT, title: '新的对话', sort: subMenuList.value.length + 1, modelType: modelOptions[modelIndex.value].value })
const conversationId = await addMessage({ type: MenuTypeEnum.TEXT_TO_TEXT, title: '新的对话', sort: subMenuList.value.length + 1, modelType: modelOptions[modelIndex.value].value })
await getConversationList()
await nextTick()
subMenuActiveIndex.value = subMenuList.value.length - 1
subMenuActiveIndex.value = subMenuList.value.findIndex(v => v.id === conversationId)
await handleSubMenuChange(subMenuActiveIndex.value)
if (!conversationData.value) {
message.error('对话发送,请稍后重试!')

4
src/views/conversationNet/index.vue

@ -156,10 +156,10 @@ async function handleSend(value: string) {
try {
spinning.value = true
messageStore.setMessageClear()
await addMessage({ type: MenuTypeEnum.CONVERSATION_NET, title: '新的对话', sort: subMenuList.value.length + 1, modelType: modelOptions[modelIndex.value].value })
const conversationId = await addMessage({ type: MenuTypeEnum.CONVERSATION_NET, title: '新的对话', sort: subMenuList.value.length + 1, modelType: modelOptions[modelIndex.value].value })
await getConversationList()
await nextTick()
subMenuActiveIndex.value = subMenuList.value.length - 1
subMenuActiveIndex.value = subMenuList.value.findIndex(v => v.id === conversationId)
await handleSubMenuChange(subMenuActiveIndex.value)
if (!conversationData.value) {
message.error('对话发送,请稍后重试!')

4
src/views/repository/index.vue

@ -175,10 +175,10 @@ async function handleSend(value: string) {
try {
spinning.value = true
messageStore.setMessageClear()
await addMessage({ type: MenuTypeEnum.REPOSITORY, title: '新的对话', sort: subMenuList.value.length + 1, modelType: modelOptions[modelIndex.value].value })
const conversationId = await addMessage({ type: MenuTypeEnum.REPOSITORY, title: '新的对话', sort: subMenuList.value.length + 1, modelType: modelOptions[modelIndex.value].value })
await getConversationList()
await nextTick()
subMenuActiveIndex.value = subMenuList.value.length - 1
subMenuActiveIndex.value = subMenuList.value.findIndex(v => v.id === conversationId)
await handleSubMenuChange(subMenuActiveIndex.value)
if (!conversationData.value) {
message.error('对话发送,请稍后重试!')

17
src/views/role/index.vue

@ -308,17 +308,24 @@ async function handleRole(item: RoleData) {
getHistoryMessage()
}
else {
await addMessage({
const conversationId = await addMessage({
type: MenuTypeEnum.ROLE,
title: item.roleName,
roleId: item.id,
sort: subMenuList.value.length + 1,
modelType: item.modelType ? item.modelType : ModelTypeEnum.GPT3,
contextCount: item.contextCount,
})
await getConversationList()
await nextTick()
const index = subMenuList.value.findIndex(v => String(v.roleId) === item.id)
if (index === -1) {
subMenuActiveIndex.value = subMenuList.value.findIndex(v => v.id === conversationId)
}
else {
subMenuActiveIndex.value = index
}
await handleSubMenuChange(index)
getHistoryMessage()
}
@ -335,17 +342,23 @@ async function handleApply(item: RoleInfoAppModel) {
getHistoryMessage()
}
else {
await addMessage({
const conversationId = await addMessage({
type: MenuTypeEnum.ROLE,
title: item.roleName,
roleId: item.id,
sort: subMenuList.value.length + 1,
modelType: item.modelType ? item.modelType : ModelTypeEnum.GPT3,
contextCount: item.contextCount,
})
await getConversationList()
await nextTick()
const index = subMenuList.value.findIndex(v => String(v.roleId) === item.id)
if (index === -1) {
subMenuActiveIndex.value = subMenuList.value.findIndex(v => v.id === conversationId)
}
else {
subMenuActiveIndex.value = index
}
await handleSubMenuChange(index)
getHistoryMessage()
}

4
src/views/textToImage/index.vue

@ -160,10 +160,10 @@ async function handleSend(value: string) {
try {
spinning.value = true
messageStore.setMessageClear()
await addMessage({ type: MenuTypeEnum.TEXT_TO_IMAGE, title: '新的对话', sort: subMenuList.value.length + 1, modelType: modelOptions[modelIndex.value].value })
const conversationId = await addMessage({ type: MenuTypeEnum.TEXT_TO_IMAGE, title: '新的对话', sort: subMenuList.value.length + 1, modelType: modelOptions[modelIndex.value].value })
await nextTick()
await getConversationList()
subMenuActiveIndex.value = subMenuList.value.length - 1
subMenuActiveIndex.value = subMenuList.value.findIndex(v => v.id === conversationId)
await handleSubMenuChange(subMenuActiveIndex.value)
if (!conversationData.value) {
return

4
src/views/visualAnalysis/index.vue

@ -160,10 +160,10 @@ async function handleSend(value: string, fileUrl: string) {
try {
spinning.value = true
messageStore.setMessageClear()
await addMessage({ type: MenuTypeEnum.VISUAL_ANALYSIS, title: '新的对话', sort: subMenuList.value.length + 1, modelType: modelOptions[modelIndex.value].value })
const conversationId = await addMessage({ type: MenuTypeEnum.VISUAL_ANALYSIS, title: '新的对话', sort: subMenuList.value.length + 1, modelType: modelOptions[modelIndex.value].value })
await getConversationList()
await nextTick()
subMenuActiveIndex.value = subMenuList.value.length - 1
subMenuActiveIndex.value = subMenuList.value.findIndex(v => v.id === conversationId)
await handleSubMenuChange(subMenuActiveIndex.value)
if (!conversationData.value) {
message.error('对话发送,请稍后重试!')

Loading…
Cancel
Save