Skip to content

Commit

Permalink
Merge branch 'feat/model-provider-based-on-runtime' into deploy/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
iamjoel committed Dec 28, 2023
2 parents d5d7699 + 3440bec commit b768764
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
11 changes: 10 additions & 1 deletion web/app/components/app/chat/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,16 @@ export type IChatItem = {

export type MessageEnd = {
id: string
retriever_resources?: CitationItem[]
metadata: {
retriever_resources?: CitationItem[]
annotation_reply: {
id: string
account: {
id: string
name: string
}
}
}
}

export type MessageReplace = {
Expand Down
23 changes: 22 additions & 1 deletion web/app/components/app/configuration/debug/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,27 @@ const Debug: FC<IDebug> = ({
}
},
onMessageEnd: (messageEnd) => {
responseItem.citation = messageEnd.retriever_resources
// TODO
if (messageEnd.metadata?.annotation_reply) {
responseItem.id = messageEnd.id
responseItem.annotation = ({
id: messageEnd.metadata.annotation_reply.id,
authorName: messageEnd.metadata.annotation_reply.account.name,
} as AnnotationType)
const newListWithAnswer = produce(
getChatList().filter(item => item.id !== responseItem.id && item.id !== placeholderAnswerId),
(draft) => {
if (!draft.find(item => item.id === questionId))
draft.push({ ...questionItem })

draft.push({
...responseItem,
})
})
setChatList(newListWithAnswer)
return
}
responseItem.citation = messageEnd.metadata?.retriever_resources || []

const newListWithAnswer = produce(
getChatList().filter(item => item.id !== responseItem.id && item.id !== placeholderAnswerId),
Expand All @@ -363,6 +383,7 @@ const Debug: FC<IDebug> = ({
responseItem.content = messageReplace.answer
},
onAnnotationReply: (annotationReply) => {
// TODO: temp debug
responseItem.id = annotationReply.id
responseItem.content = annotationReply.answer
responseItem.annotation = ({
Expand Down
2 changes: 1 addition & 1 deletion web/app/components/explore/universal-chat/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ const Main: FC<IMainProps> = () => {
setChatList(newListWithAnswer)
},
onMessageEnd: (messageEnd) => {
responseItem.citation = messageEnd.retriever_resources
responseItem.citation = messageEnd.metadata?.retriever_resources

const newListWithAnswer = produce(
getChatList().filter(item => item.id !== responseItem.id && item.id !== placeholderAnswerId),
Expand Down
2 changes: 1 addition & 1 deletion web/app/components/share/chat/sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const Sidebar: FC<ISidebarProps> = ({
<div className="flex flex-shrink-0 p-4 !pb-0">
<Button
onClick={() => onStartChat({})}
className="group block w-full flex-shrink-0 !justify-start !h-9 text-primary-600 items-center text-sm">
className="flex group w-full flex-shrink-0 !justify-start !h-9 text-primary-600 items-center text-sm">
<PencilSquareIcon className="mr-2 h-4 w-4" /> {t('share.chat.newChat')}
</Button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion web/app/components/share/chatbot/sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const Sidebar: FC<ISidebarProps> = ({
<div className="flex flex-shrink-0 p-4 !pb-0">
<Button
onClick={() => { onCurrentIdChange('-1') }}
className="group block w-full flex-shrink-0 !justify-start !h-9 text-primary-600 items-center text-sm">
className="group flex w-full flex-shrink-0 !justify-start !h-9 text-primary-600 items-center text-sm">
<PencilSquareIcon className="mr-2 h-4 w-4" /> {t('share.chat.newChat')}
</Button>
</div>
Expand Down

0 comments on commit b768764

Please sign in to comment.