Skip to content

Commit 3dfc3ae

Browse files
authored
Merge pull request #71 from NillionNetwork/feat/various
Feat/various
2 parents e0826b2 + 5d6f42e commit 3dfc3ae

File tree

9 files changed

+52
-32
lines changed

9 files changed

+52
-32
lines changed

docker-compose-nilcc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
app:
3-
image: public.ecr.aws/x8g8t2h7/nilgpt:0.5.0
3+
image: public.ecr.aws/x8g8t2h7/nilgpt:0.5.1
44
container_name: nilGPT
55
ports:
66
- "3000:3000"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nil-gpt",
3-
"version": "0.5.0",
3+
"version": "0.5.1",
44
"private": true,
55
"scripts": {
66
"dev": "next dev",

scripts/measurement-hash.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ ROOT_PATH="$SCRIPT_PATH/../"
77
DOCKER_COMPOSE_HASH=$(sha256sum $ROOT_PATH/docker-compose-nilcc.yaml | cut -d" " -f1)
88
VCPUS=4
99
NILCC_VERSION=0.1.2
10+
NILCC_VERIFIER_VERSION=0.2.1
1011

11-
MEASUREMENT_HASH=$(docker run -v/tmp/nilcc-verifier-cache:/tmp/nilcc-verifier-cache --rm ghcr.io/nillionnetwork/nilcc-verifier:latest measurement-hash $DOCKER_COMPOSE_HASH $NILCC_VERSION --vm-type cpu --cpus $VCPUS)
12+
MEASUREMENT_HASH=$(docker run -v/tmp/nilcc-verifier-cache:/tmp/nilcc-verifier-cache --rm ghcr.io/nillionnetwork/nilcc-verifier:$NILCC_VERIFIER_VERSION measurement-hash $DOCKER_COMPOSE_HASH $NILCC_VERSION --vm-type cpu --cpus $VCPUS)
1213
echo "$MEASUREMENT_HASH"

src/app/api/createMessage/route.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export async function POST(request: NextRequest) {
2323
attachments,
2424
pwa,
2525
sources,
26+
web_search,
2627
} = body;
2728

2829
if (!chat_id || !role || !blindfoldContent || order === undefined) {
@@ -55,6 +56,7 @@ export async function POST(request: NextRequest) {
5556
pwa,
5657
...(attachments?.length > 0 && { attachments }),
5758
...(sources?.length > 0 && { sources }),
59+
...(web_search === true && { web_search: true }),
5860
};
5961

6062
const builder = await setupClient();

src/components/auth/AuthModal.tsx

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default function AuthModal({
1818
const [name, setName] = useState("");
1919
const [error, setError] = useState("");
2020
const [keepMePosted, setKeepMePosted] = useState(false);
21-
const [showEmailConfirmation, setShowEmailConfirmation] = useState(false);
21+
const [_showEmailConfirmation, _setShowEmailConfirmation] = useState(false);
2222
const { signIn, signUp } = useAuth();
2323

2424
const handleSubmit = async (e: React.FormEvent) => {
@@ -31,35 +31,37 @@ export default function AuthModal({
3131
onClose();
3232
} else {
3333
await signUp(email, password, name, keepMePosted);
34-
setShowEmailConfirmation(true);
34+
// setShowEmailConfirmation(true);
35+
onClose();
3536
}
3637
} catch (err) {
3738
setError(err instanceof Error ? err.message : "An error occurred");
3839
}
3940
};
4041

41-
if (showEmailConfirmation) {
42-
return (
43-
<div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
44-
<div className="bg-white rounded-lg p-8 max-w-md w-full mx-4">
45-
<h2 className="text-2xl font-bold mb-4">Check your email</h2>
46-
<p className="text-gray-600 mb-6">
47-
We&apos;ve sent a confirmation link to{" "}
48-
<span className="font-medium">{email}</span>. Please check your
49-
email to complete your registration.
50-
</p>
51-
<div className="flex justify-end">
52-
<button
53-
onClick={onClose}
54-
className="px-4 py-2 text-sm font-medium text-white bg-black rounded-md hover:bg-gray-800"
55-
>
56-
Close
57-
</button>
58-
</div>
59-
</div>
60-
</div>
61-
);
62-
}
42+
// Disabled: Email confirmation modal
43+
// if (showEmailConfirmation) {
44+
// return (
45+
// <div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
46+
// <div className="bg-white rounded-lg p-8 max-w-md w-full mx-4">
47+
// <h2 className="text-2xl font-bold mb-4">Check your email</h2>
48+
// <p className="text-gray-600 mb-6">
49+
// We&apos;ve sent a confirmation link to{" "}
50+
// <span className="font-medium">{email}</span>. Please check your
51+
// email to complete your registration.
52+
// </p>
53+
// <div className="flex justify-end">
54+
// <button
55+
// onClick={onClose}
56+
// className="px-4 py-2 text-sm font-medium text-white bg-black rounded-md hover:bg-gray-800"
57+
// >
58+
// Close
59+
// </button>
60+
// </div>
61+
// </div>
62+
// </div>
63+
// );
64+
// }
6365

6466
return (
6567
<div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">

src/components/chat/StreamingChatArea/index.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,10 @@ const StreamingChatArea: React.FC<StreamingChatAreaProps> = ({
203203
order: number;
204204
attachments?: TMessageAttachment[];
205205
sources?: IWebSearchSource[];
206+
web_search?: boolean;
206207
}) => {
207-
const { chatId, role, content, order, attachments, sources } = message;
208+
const { chatId, role, content, order, attachments, sources, web_search } =
209+
message;
208210

209211
if (!user) {
210212
console.error("No authenticated user found");
@@ -240,6 +242,7 @@ const StreamingChatArea: React.FC<StreamingChatAreaProps> = ({
240242
attachments,
241243
sources,
242244
...(isPWA && { pwa: true }),
245+
...(web_search === true && { web_search: true }),
243246
}),
244247
});
245248

@@ -379,7 +382,7 @@ const StreamingChatArea: React.FC<StreamingChatAreaProps> = ({
379382
return updated;
380383
});
381384
},
382-
onComplete: async (finalContent, sources) => {
385+
onComplete: async (finalContent, sources, webSearchUsed) => {
383386
// Ensure final content is set
384387
setMessages((prev) => {
385388
const updated = [...prev];
@@ -413,6 +416,7 @@ const StreamingChatArea: React.FC<StreamingChatAreaProps> = ({
413416
content: finalContent,
414417
order: 2,
415418
sources,
419+
web_search: webSearchUsed,
416420
});
417421

418422
// Update chat title immediately after first back and forth
@@ -471,6 +475,7 @@ const StreamingChatArea: React.FC<StreamingChatAreaProps> = ({
471475
content: finalContent,
472476
order: totalMessages,
473477
sources,
478+
web_search: webSearchUsed,
474479
})
475480
: Promise.resolve(),
476481
]);

src/components/landingPage/FAQSection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const FAQSection = () => {
4444
{
4545
question: "What AI models are used in nilGPT?",
4646
answer:
47-
"Currently the Llama-3.2-3B-Instruct model is used in nilGPT, however we are continuously evaluating which models provide the best accuracy and latency.",
47+
"Currently the gpt-oss-20b and gemma-3-27b-it models are used in nilGPT, however we are continuously evaluating which models provide the best accuracy and latency.",
4848
},
4949
{
5050
question: "Is my data used to train the models?",

src/hooks/useStreamingChat.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ export interface UseStreamingChatOptions {
77
model?: TLLMName;
88
shouldUseWebSearch?: boolean;
99
onUpdate?: (content: string) => void;
10-
onComplete?: (content: string, sources?: IWebSearchSource[]) => void;
10+
onComplete?: (
11+
content: string,
12+
sources?: IWebSearchSource[],
13+
webSearchUsed?: boolean,
14+
) => void;
1115
onError?: (error: string) => void;
1216
}
1317

@@ -54,6 +58,7 @@ export function useStreamingChat() {
5458
const decoder = new TextDecoder();
5559
let accumulatedContent = "";
5660
let webSearchSources: IWebSearchSource[] = [];
61+
let webSearchUsed = false;
5762

5863
setIsLoading(false);
5964
setIsStreaming(true);
@@ -108,12 +113,16 @@ export function useStreamingChat() {
108113
"You have reached the daily limit for web search. Your prompt was routed to the model without web search.",
109114
{ duration: 8000 },
110115
);
116+
webSearchUsed = false; // Rate limit reached, web search was not used
117+
} else {
118+
// Web search was used if we requested it and didn't hit rate limit
119+
webSearchUsed = !!shouldUseWebSearch;
111120
}
112121
reader.releaseLock();
113122
}
114123

115124
setIsStreaming(false);
116-
onComplete?.(accumulatedContent, webSearchSources);
125+
onComplete?.(accumulatedContent, webSearchSources, webSearchUsed);
117126
return accumulatedContent;
118127
} catch (error) {
119128
setIsLoading(false);

src/types/schemas.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,5 @@ export interface MESSAGES_SCHEMA {
4444
token_count?: string;
4545
attachments?: TMessageAttachment[];
4646
pwa?: boolean;
47+
web_search?: boolean;
4748
}

0 commit comments

Comments
 (0)