Compare commits

...

2 Commits

Author SHA1 Message Date
ItzCrazyKns
3d2d056f64 Update Chat.tsx 2025-10-19 22:47:45 +05:30
ItzCrazyKns
d9ebf611ff feat(hf-transformer): dynamically load library 2025-10-19 21:06:52 +05:30
2 changed files with 2 additions and 2 deletions

View File

@@ -16,7 +16,7 @@ const Chat = () => {
useEffect(() => {
const updateDividerWidth = () => {
if (dividerRef.current) {
setDividerWidth(dividerRef.current.scrollWidth);
setDividerWidth(dividerRef.current.offsetWidth);
}
};

View File

@@ -1,6 +1,5 @@
import { Embeddings, type EmbeddingsParams } from '@langchain/core/embeddings';
import { chunkArray } from '@langchain/core/utils/chunk_array';
import { pipeline } from '@huggingface/transformers';
export interface HuggingFaceTransformersEmbeddingsParams
extends EmbeddingsParams {
@@ -68,6 +67,7 @@ export class HuggingFaceTransformersEmbeddings
}
private async runEmbedding(texts: string[]) {
const { pipeline } = await import('@huggingface/transformers');
const pipe = await pipeline('feature-extraction', this.model);
return this.caller.call(async () => {