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. 21
      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 sort: number
roleId?: string roleId?: string
modelType: ModelTypeEnum modelType: ModelTypeEnum
contextCount?: number | null // 携带上下文数量
}) { }) {
return defHttp.post({ return defHttp.post({
url: `/open-chat/chat/conversation/save`, url: `/open-chat/chat/conversation/save`,

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

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

3
src/components/AppRoleDefault/index.vue

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

2
src/components/AppSubMenuList/index.vue

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

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

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

4
src/views/conversation/index.vue

@ -156,10 +156,10 @@ async function handleSend(value: string) {
try { try {
spinning.value = true spinning.value = true
messageStore.setMessageClear() 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 getConversationList()
await nextTick() await nextTick()
subMenuActiveIndex.value = subMenuList.value.length - 1 subMenuActiveIndex.value = subMenuList.value.findIndex(v => v.id === conversationId)
await handleSubMenuChange(subMenuActiveIndex.value) await handleSubMenuChange(subMenuActiveIndex.value)
if (!conversationData.value) { if (!conversationData.value) {
message.error('对话发送,请稍后重试!') message.error('对话发送,请稍后重试!')

4
src/views/conversationNet/index.vue

@ -156,10 +156,10 @@ async function handleSend(value: string) {
try { try {
spinning.value = true spinning.value = true
messageStore.setMessageClear() 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 getConversationList()
await nextTick() await nextTick()
subMenuActiveIndex.value = subMenuList.value.length - 1 subMenuActiveIndex.value = subMenuList.value.findIndex(v => v.id === conversationId)
await handleSubMenuChange(subMenuActiveIndex.value) await handleSubMenuChange(subMenuActiveIndex.value)
if (!conversationData.value) { if (!conversationData.value) {
message.error('对话发送,请稍后重试!') message.error('对话发送,请稍后重试!')

4
src/views/repository/index.vue

@ -175,10 +175,10 @@ async function handleSend(value: string) {
try { try {
spinning.value = true spinning.value = true
messageStore.setMessageClear() 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 getConversationList()
await nextTick() await nextTick()
subMenuActiveIndex.value = subMenuList.value.length - 1 subMenuActiveIndex.value = subMenuList.value.findIndex(v => v.id === conversationId)
await handleSubMenuChange(subMenuActiveIndex.value) await handleSubMenuChange(subMenuActiveIndex.value)
if (!conversationData.value) { if (!conversationData.value) {
message.error('对话发送,请稍后重试!') message.error('对话发送,请稍后重试!')

21
src/views/role/index.vue

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

4
src/views/textToImage/index.vue

@ -160,10 +160,10 @@ async function handleSend(value: string) {
try { try {
spinning.value = true spinning.value = true
messageStore.setMessageClear() 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 nextTick()
await getConversationList() await getConversationList()
subMenuActiveIndex.value = subMenuList.value.length - 1 subMenuActiveIndex.value = subMenuList.value.findIndex(v => v.id === conversationId)
await handleSubMenuChange(subMenuActiveIndex.value) await handleSubMenuChange(subMenuActiveIndex.value)
if (!conversationData.value) { if (!conversationData.value) {
return return

4
src/views/visualAnalysis/index.vue

@ -160,10 +160,10 @@ async function handleSend(value: string, fileUrl: string) {
try { try {
spinning.value = true spinning.value = true
messageStore.setMessageClear() 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 getConversationList()
await nextTick() await nextTick()
subMenuActiveIndex.value = subMenuList.value.length - 1 subMenuActiveIndex.value = subMenuList.value.findIndex(v => v.id === conversationId)
await handleSubMenuChange(subMenuActiveIndex.value) await handleSubMenuChange(subMenuActiveIndex.value)
if (!conversationData.value) { if (!conversationData.value) {
message.error('对话发送,请稍后重试!') message.error('对话发送,请稍后重试!')

Loading…
Cancel
Save