Skip to content

Commit

Permalink
bugfix: fix chat UI to support not having content
Browse files Browse the repository at this point in the history
  • Loading branch information
densumesh authored and skeptrunedev committed May 9, 2024
1 parent d4626da commit daa5b15
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
6 changes: 2 additions & 4 deletions chat/src/components/ScoreChunk.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ const ScoreChunk = (props: ScoreChunkProps) => {
"text/html": new Blob([props.chunk.chunk_html ?? ""], {
type: "text/html",
}),
"text/plain": new Blob([props.chunk.content], {
type: "text/plain",
}),
}),
])
.then(() => {
Expand All @@ -99,7 +96,8 @@ const ScoreChunk = (props: ScoreChunkProps) => {
};

const useExpand = createMemo(() => {
return props.chunk.content.split(" ").length > 20 * linesBeforeShowMore;
if (!props.chunk.chunk_html) return false;
return props.chunk.chunk_html.split(" ").length > 20 * linesBeforeShowMore;
});

return (
Expand Down
5 changes: 0 additions & 5 deletions chat/src/utils/apiTypes.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export interface ChunkMetadata {
id: string;
content: string;
chunk_html?: string;
link: string | null;
qdrant_point_id: string;
Expand Down Expand Up @@ -33,8 +32,6 @@ export const isChunkMetadata = (chunk: unknown): chunk is ChunkMetadata => {
return (
indirectHasOwnProperty(chunk, "id") &&
typeof (chunk as ChunkMetadata).id === "string" &&
indirectHasOwnProperty(chunk, "content") &&
typeof (chunk as ChunkMetadata).content === "string" &&
indirectHasOwnProperty(chunk, "qdrant_point_id") &&
typeof (chunk as ChunkMetadata).qdrant_point_id === "string" &&
indirectHasOwnProperty(chunk, "created_at") &&
Expand All @@ -61,8 +58,6 @@ export const isChunkMetadataWithVotes = (
return (
indirectHasOwnProperty(chunk, "id") &&
typeof (chunk as ChunkMetadataWithVotes).id === "string" &&
indirectHasOwnProperty(chunk, "content") &&
typeof (chunk as ChunkMetadataWithVotes).content === "string" &&
indirectHasOwnProperty(chunk, "qdrant_point_id") &&
typeof (chunk as ChunkMetadataWithVotes).qdrant_point_id === "string" &&
indirectHasOwnProperty(chunk, "created_at") &&
Expand Down

0 comments on commit daa5b15

Please sign in to comment.