Skip to content
Open
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
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1 +1 @@
NEXT_PUBLIC_OLLAMA_BASEURL=
NEXT_PUBLIC_OLLAMA_BASEURL=
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/minimal-llm-ui.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/prettier.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

89 changes: 89 additions & 0 deletions APIs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
## API's to the chat interface.

API Host: http://localhost:5329

### Generic Database Search

POST {{host}}/v1.0/sql/query
Content-Type: application/json
Accept: application/json

{
"query": "select content from \"view-9468964f-058a-4f2e-89ab-8b351ff082ba\" where document_guid = 'f49f92f7-8cdf-4f44-b327-0519e2aad881' and content LENGTH(content) > 5;",
"limit": 10
}

### Vector search

#### Request
* Headers
```text
POST {{host}}/v1.0/vector/search
Content-Type: application/json
Accept: application/json
```

* BODY

```json
{
"query": "What is the main topic?",
"document_guid": "f49f92f7-8cdf-4f44-b327-0519e2aad881",
"limit": 5
}
```

#### Response
* Headers

```text
date: Fri, 18 Jul 2025 15:52:31 GMT
server: uvicorn
content-length: 1266
content-type: application/json
x-request-id: 95aa4000-9c28-4093-9265-db47a2dde78d
```

* Body

```json
{
"status": "success",
"query": "What is the main topic?",
"document_guid": "f49f92f7-8cdf-4f44-b327-0519e2aad881",
"limit": 5,
"result_count": 5,
"results": [
{
"id": 1,
"content": "Reference guide",
"length": 15,
"distance": 0.6795133566276237
},
{
"id": 1565,
"content": "Enterprise",
"length": 10,
"distance": 0.7974459138448121
},
{
"id": 363,
"content": "1 . Serial number label pull tab 5 . NIC status LED 2 . Quick removal access panel 6 . UID button / LED 3 . Power On / Standby button and system power LED 7 . GPU cage ( 8 DW GPUs ) 4 . Health LED 8 . 1U drive cage ( up to 8 SFF or 8 EDSFF 1T drives ) Figure 1 . HPE ProLiant Compute DL380a Gen12 Server—Front system detail",
"length": 323,
"distance": 0.9242449513442739
},
{
"id": 1079,
"content": "Chat now ( sales )",
"length": 18,
"distance": 0.9243938094603021
},
{
"id": 375,
"content": "7 8 9 10 11 1 . Power supply for the system board 6 . Power supply for the system board 2 . Power supplies for GPU auxiliary power 7 . VGA 3 . Primary riser slots 1 - 3 8 . Two ( 2 ) USB 3 . 0 ports 4 . Secondary riser slots 4 - 6 9 . HPE iLO management port 5 . Power supplies for GPU auxiliary power 10 . OCP 3 . 0 slot 1 11 . OCP 3 . 0 slot 2 Figure 2 . HPE ProLiant Compute DL380a Gen12 Server—Rear system detail",
"length": 416,
"distance": 0.9250164240618253
}
]
}
```
88 changes: 88 additions & 0 deletions public/Hewlett_Packard_Enterprise_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/app/context/ModalContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export const useModal = () => {

export enum AppModal {
SAVE_PROMPT = "savePrompt",
ADD_SYSTEM_INSTRUCTION = "addSystemInstruction",
EDIT_SYSTEM_INSTRUCTION = "editSystemInstruction",
}

export const ModalProvider = ({ children }: { children: React.ReactNode }) => {
Expand All @@ -27,4 +29,3 @@ export const ModalProvider = ({ children }: { children: React.ReactNode }) => {
<ModalContext.Provider value={value}>{children}</ModalContext.Provider>
);
};

114 changes: 114 additions & 0 deletions src/app/context/SystemInstructionContext.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
"use client";

import { createContext, useContext, useState, useEffect } from "react";
import {
SystemInstruction,
getDefaultSystemInstruction,
getSystemInstructionById,
getAllSystemInstructions,
addSystemInstruction,
updateSystemInstruction
} from "@/utils/systemInstructions";

// Create context with default values
const SystemInstructionContext = createContext<{
activeSystemInstruction: SystemInstruction;
setActiveSystemInstructionById: (id: string) => void;
allSystemInstructions: SystemInstruction[];
addNewSystemInstruction: (name: string, content: string) => void;
updateExistingSystemInstruction: (id: string, name: string, content: string) => void;
}>({
activeSystemInstruction: getDefaultSystemInstruction(),
setActiveSystemInstructionById: () => {},
allSystemInstructions: getAllSystemInstructions(),
addNewSystemInstruction: () => {},
updateExistingSystemInstruction: () => {},
});

// Hook to use the system instruction context
export function useSystemInstruction() {
return useContext(SystemInstructionContext);
}

// Provider component
export function SystemInstructionProvider({ children }: { children: React.ReactNode }) {
// Initialize with the default system instruction
const [activeSystemInstruction, setActiveSystemInstruction] = useState<SystemInstruction>(
getDefaultSystemInstruction()
);

const [allSystemInstructions, setAllSystemInstructions] = useState<SystemInstruction[]>(
getAllSystemInstructions()
);

// Load the active system instruction from localStorage on component mount
useEffect(() => {
const storedInstructionId = localStorage.getItem("activeSystemInstructionId");
if (storedInstructionId) {
const instruction = getSystemInstructionById(storedInstructionId);
if (instruction) {
setActiveSystemInstruction(instruction);
}
}
}, []);

// Function to set the active system instruction by ID
const setActiveSystemInstructionById = (id: string) => {
const instruction = getSystemInstructionById(id);
if (instruction) {
setActiveSystemInstruction(instruction);
localStorage.setItem("activeSystemInstructionId", id);
}
};

// Function to add a new system instruction
const addNewSystemInstruction = (name: string, content: string) => {
// Create a new instruction object
const newInstruction: SystemInstruction = {
id: `instruction-${Date.now()}`,
name,
content
};

// Add it to the system instructions
addSystemInstruction(newInstruction);

// Update the local state with the latest instructions
setAllSystemInstructions(getAllSystemInstructions());

// Return the new instruction ID in case it's needed
return newInstruction.id;
};

// Function to update an existing system instruction
const updateExistingSystemInstruction = (id: string, name: string, content: string) => {
// Update the instruction
updateSystemInstruction(id, name, content);

// Update the local state with the latest instructions
setAllSystemInstructions(getAllSystemInstructions());

// If the active instruction was updated, update it in the state
if (activeSystemInstruction.id === id) {
const updatedInstruction = getSystemInstructionById(id);
if (updatedInstruction) {
setActiveSystemInstruction(updatedInstruction);
}
}
};

// Context value
const value = {
activeSystemInstruction,
setActiveSystemInstructionById,
allSystemInstructions,
addNewSystemInstruction,
updateExistingSystemInstruction,
};

return (
<SystemInstructionContext.Provider value={value}>
{children}
</SystemInstructionContext.Provider>
);
}
Loading