chore: remove universal chat code (#2194)

This commit is contained in:
Joel 2024-01-25 11:47:35 +08:00 • committed by GitHub
commit bec998ab94
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 10 additions and 1720 deletions

View file

@ -9,7 +9,6 @@ import RenameModal from '../rename-modal'
import Item from './item'
import type { ConversationItem } from '@/models/share'
import { fetchConversations, renameConversation } from '@/service/share'
import { fetchConversations as fetchUniversalConversations, renameConversation as renameUniversalConversation } from '@/service/universal-chat'
import Toast from '@/app/components/base/toast'
export type IListProps = {
@ -20,7 +19,6 @@ export type IListProps = {
onListChanged?: (newList: ConversationItem[]) => void
isClearConversationList: boolean
isInstalledApp: boolean
isUniversalChat?: boolean
installedAppId?: string
onMoreLoaded: (res: { data: ConversationItem[]; has_more: boolean }) => void
isNoMore: boolean
@ -38,7 +36,6 @@ const List: FC<IListProps> = ({
onListChanged,
isClearConversationList,
isInstalledApp,
isUniversalChat,
installedAppId,
onMoreLoaded,
isNoMore,
@ -56,11 +53,7 @@ const List: FC<IListProps> = ({
let lastId = !isClearConversationList ? list[list.length - 1]?.id : undefined
if (lastId === '-1')
lastId = undefined
let res: any
if (isUniversalChat)
res = await fetchUniversalConversations(lastId, isPinned)
else
res = await fetchConversations(isInstalledApp, installedAppId, lastId, isPinned)
const res = await fetchConversations(isInstalledApp, installedAppId, lastId, isPinned) as any
const { data: conversations, has_more }: any = res
onMoreLoaded({ data: conversations, has_more })
}
@ -93,11 +86,7 @@ const List: FC<IListProps> = ({
setIsSaving()
const currId = currentConversation.id
try {
if (isUniversalChat)
await renameUniversalConversation(currId, newName)
else
await renameConversation(isInstalledApp, installedAppId, currId, newName)
await renameConversation(isInstalledApp, installedAppId, currId, newName)
Toast.notify({
type: 'success',