Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.19.1]
node-version: [20.18.0]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -43,7 +43,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.19.1]
node-version: [20.18.0]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -62,7 +62,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.19.1]
node-version: [20.18.0]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18.19.1-alpine AS package
FROM node:20.18.0-alpine AS package

ARG NEXT_PUBLIC_UMAMI_SITE_ID
ARG NEXT_PUBLIC_RECAPTCHA_SITEKEY
Expand Down Expand Up @@ -37,7 +37,9 @@ WORKDIR /app

RUN cp config/localConfig.example.ts config/localConfig.ts
RUN apk add --no-cache git python3 make g++
RUN yarn install --production
RUN corepack enable
ENV SKIP_OPTIONAL=true
RUN yarn install --mode=skip-build || yarn install
RUN NEXT_PUBLIC_UMAMI_SITE_ID=$NEXT_PUBLIC_UMAMI_SITE_ID \
NEXT_PUBLIC_RECAPTCHA_SITEKEY=$NEXT_PUBLIC_RECAPTCHA_SITEKEY \
NEXT_PUBLIC_ENVIRONMENT=$NEXT_PUBLIC_ENVIRONMENT \
Expand All @@ -46,7 +48,7 @@ RUN NEXT_PUBLIC_UMAMI_SITE_ID=$NEXT_PUBLIC_UMAMI_SITE_ID \
NEXT_PUBLIC_ENABLE_BANNER_DONATION=$NEXT_PUBLIC_ENABLE_BANNER_DONATION \
yarn build

FROM node:18.19.1-alpine
FROM node:20.18.0-alpine

LABEL maintainer="Giovanni Rossini <giovannijrrossini@gmail.com>"

Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,9 @@
"md5": "^2.3.0",
"migrate-mongo-ts": "^1.1.4",
"moment": "^2.30.1",
"mongodb": "^6.18.0",
"mongodb-memory-server": "^10.0.0",
"mongoose": "^ 5.13.15",
"mongoose": "^5.13.15",
"mongoose-softdelete-typescript": "^0.0.3",
"nestjs-unleash": "^2.2.3",
"newrelic": "^11.5.0",
Expand Down Expand Up @@ -276,5 +277,8 @@
"glob": "^9.0.0",
"tldjs": "2.3.1"
},
"engines": {
"node": ">=20.18.0"
},
"packageManager": "yarn@3.6.3"
}
4 changes: 3 additions & 1 deletion server/copilot/copilot-chat.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ export class CopilotChatService {
const llm = new ChatOpenAI({
temperature: +openAI.BASIC_CHAT_OPENAI_TEMPERATURE,
modelName: openAI.GPT_3_5_TURBO_1106.toString(),
apiKey: this.configService.get<string>("openai.api_key"),
configuration: {
apiKey: this.configService.get<string>("openai.api_key"),
},
});

const agent = await createOpenAIFunctionsAgent({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export class SummarizationCrawlerChainService {
const llm = new ChatOpenAI({
temperature: +openAI.BASIC_CHAT_OPENAI_TEMPERATURE,
modelName: openAI.GPT_3_5_TURBO_1106.toString(),
apiKey: this.configService.get<string>("openai.api_key"),
configuration: {
apiKey: this.configService.get<string>("openai.api_key"),
},
});

return loadSummarizationChain(llm, {
Expand Down
4 changes: 3 additions & 1 deletion server/summarization/summarization-crawler.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ export class SummarizationCrawlerService {
const llm = new ChatOpenAI({
temperature: +openAI.BASIC_CHAT_OPENAI_TEMPERATURE,
modelName: openAI.GPT_3_5_TURBO_1106.toString(),
apiKey: this.configService.get<string>("openai.api_key"),
configuration: {
apiKey: this.configService.get<string>("openai.api_key"),
},
});

const embeddings = new OpenAIEmbeddings();
Expand Down
4 changes: 3 additions & 1 deletion server/tests/utils/AdminUserMock.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { ObjectId } from "mongodb";

export const AdminUserMock = {
_id: "62585756d665dc7bf4b14aa3",
_id: new ObjectId("62585756d665dc7bf4b14aa3"),
email: "test-e2e@aletheiafact.org",
firstPasswordChanged: true,
hash: null,
Expand Down
4 changes: 2 additions & 2 deletions server/wikidata/wikidata.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ const WikidataCacheModel = MongooseModule.forFeatureAsync([
const wikidataCacheSchema = WikidataCacheSchema;
wikidataCacheSchema.index(
{ wikidataId: 1, language: 1 },
{ unique: true }
{ unique: true } as any
);
wikidataCacheSchema.index(
{ createdAt: 1 },
{ expireAfterSeconds: 86400 }
{ expireAfterSeconds: 86400 } as any
);
return wikidataCacheSchema;
},
Expand Down
46 changes: 28 additions & 18 deletions src/components/ReviewedImage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable @next/next/no-img-element */
import React, { useEffect, useRef, useState } from "react";
import lottie from "lottie-web";
import { generateLottie } from "../lottiefiles/generateLottie";
import { ClassificationEnum } from "../types/enums";

Expand All @@ -14,6 +13,7 @@ const ReviewedImage = ({
classification?: keyof typeof ClassificationEnum;
}) => {
const [animation, setAnimation] = useState<any>(null);
const [lottieInstance, setLottieInstance] = useState<any>(null);
const container = useRef(null);
const getImageMeta = (url) =>
new Promise((resolve, reject) => {
Expand Down Expand Up @@ -65,33 +65,43 @@ const ReviewedImage = ({
}, []);

useEffect(() => {
if (classification) {
lottie.loadAnimation({
container: container.current,
renderer: "svg",
loop: false,
autoplay: false,
animationData: animation,
rendererSettings: {
preserveAspectRatio: "xMinYMin meet",
viewBoxSize: "10 10",
},
if (classification && animation && typeof window !== 'undefined') {
// Dynamic import to avoid SSR issues
import('lottie-web').then((lottie) => {
const animationInstance = lottie.default.loadAnimation({
container: container.current,
renderer: "svg",
loop: false,
autoplay: false,
animationData: animation,
rendererSettings: {
preserveAspectRatio: "xMinYMin meet",
viewBoxSize: "10 10",
},
});
setLottieInstance({ lottie: lottie.default, animation: animationInstance });
lottie.default.setSpeed(1.5);
});
lottie.setSpeed(1.5);
}
return () => {
lottie.destroy();
if (lottieInstance?.animation) {
lottieInstance.animation.destroy();
}
};
}, [animation, classification]);

const handleMouseEnter = () => {
lottie.setDirection(1);
lottie.play();
if (lottieInstance?.lottie) {
lottieInstance.lottie.setDirection(1);
lottieInstance.lottie.play();
}
};

const handleMouseLeave = () => {
lottie.setDirection(-1);
lottie.play();
if (lottieInstance?.lottie) {
lottieInstance.lottie.setDirection(-1);
lottieInstance.lottie.play();
}
};
return (
<>
Expand Down
61 changes: 56 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4165,6 +4165,15 @@ __metadata:
languageName: node
linkType: hard

"@mongodb-js/saslprep@npm:^1.1.9":
version: 1.3.0
resolution: "@mongodb-js/saslprep@npm:1.3.0"
dependencies:
sparse-bitfield: ^3.0.3
checksum: 0003ab0a943220df74f8ffcf076c4e4fc4105b20d6b1610d802231d2a6d3b74ad0fa9d26e3d828cb07daabe511ffb2760c347f7a4c0f985d8a7770f7d95190a3
languageName: node
linkType: hard

"@mui/base@npm:5.0.0-beta.17":
version: 5.0.0-beta.17
resolution: "@mui/base@npm:5.0.0-beta.17"
Expand Down Expand Up @@ -11644,8 +11653,9 @@ __metadata:
md5: ^2.3.0
migrate-mongo-ts: ^1.1.4
moment: ^2.30.1
mongodb: ^6.18.0
mongodb-memory-server: ^10.0.0
mongoose: ^ 5.13.15
mongoose: ^5.13.15
mongoose-softdelete-typescript: ^0.0.3
nestjs-unleash: ^2.2.3
newrelic: ^11.5.0
Expand Down Expand Up @@ -13041,6 +13051,13 @@ __metadata:
languageName: node
linkType: hard

"bson@npm:^6.10.4":
version: 6.10.4
resolution: "bson@npm:6.10.4"
checksum: 5b0b625ac9b3661497aa1baec58c8e8979cc501a5c490a5740001b3cc415d0d5d51f16bf9da433b28ffd1303b6f98c1427e8192cf4220b13b09a9a4184bfceb2
languageName: node
linkType: hard

"bson@npm:^6.7.0":
version: 6.8.0
resolution: "bson@npm:6.8.0"
Expand Down Expand Up @@ -22355,6 +22372,40 @@ __metadata:
languageName: node
linkType: hard

"mongodb@npm:^6.18.0":
version: 6.18.0
resolution: "mongodb@npm:6.18.0"
dependencies:
"@mongodb-js/saslprep": ^1.1.9
bson: ^6.10.4
mongodb-connection-string-url: ^3.0.0
peerDependencies:
"@aws-sdk/credential-providers": ^3.188.0
"@mongodb-js/zstd": ^1.1.0 || ^2.0.0
gcp-metadata: ^5.2.0
kerberos: ^2.0.1
mongodb-client-encryption: ">=6.0.0 <7"
snappy: ^7.2.2
socks: ^2.7.1
peerDependenciesMeta:
"@aws-sdk/credential-providers":
optional: true
"@mongodb-js/zstd":
optional: true
gcp-metadata:
optional: true
kerberos:
optional: true
mongodb-client-encryption:
optional: true
snappy:
optional: true
socks:
optional: true
checksum: 2bb06653a86ed92090594e870f7e9c7effb4f4bb4ea0a923574c2e97711fd88714d7bfed889782c2116bedbd8d4809da3f42176bca6cd5382a389f6260125922
languageName: node
linkType: hard

"mongodb@npm:^6.7.0":
version: 6.8.0
resolution: "mongodb@npm:6.8.0"
Expand Down Expand Up @@ -22405,9 +22456,9 @@ __metadata:
languageName: node
linkType: hard

"mongoose@npm:^ 5.13.15":
version: 5.13.20
resolution: "mongoose@npm:5.13.20"
"mongoose@npm:^5.13.15":
version: 5.13.23
resolution: "mongoose@npm:5.13.23"
dependencies:
"@types/bson": 1.x || 4.0.x
"@types/mongodb": ^3.5.27
Expand All @@ -22423,7 +22474,7 @@ __metadata:
safe-buffer: 5.2.1
sift: 13.5.2
sliced: 1.0.1
checksum: 960326fc34d0d8b5c7cf9e97148e1a286aa13b1df96f51c2af83fa64d4e586625616c370ac69f8a64fc05bf3ec64ada0a5b79c85a03a29866ef5ae62d16cbde9
checksum: 229e8a50b06cca8b2d247f49ea62eecc41fb2d7f315150cd034b6f8fa1f0421897d8976c491f91ea34d8efe272f56b913e8cd50ee583a3286754a31c9dab0e8f
languageName: node
linkType: hard

Expand Down
Loading