Compare commits

..

2 Commits

  1. 1
      src/api/base/message.ts
  2. 2
      src/components/AppRoleDefault/index.d.ts
  3. 2
      src/components/AppSubMenuList/index.vue
  4. 3
      src/store/moules/messageStore/index.d.ts
  5. 4
      src/views/conversation/index.vue
  6. 4
      src/views/conversationNet/index.vue
  7. 4
      src/views/repository/index.vue
  8. 21
      src/views/role/index.vue
  9. 4
      src/views/textToImage/index.vue
  10. 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 {

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('对话发送,请稍后重试!')

21
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)
subMenuActiveIndex.value = index
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)
subMenuActiveIndex.value = index
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