Making UI progress; seeding lkml RAG
This commit is contained in:
parent
dcb4d35d07
commit
a062edb3dc
@ -20,6 +20,8 @@ import MenuIcon from '@mui/icons-material/Menu';
|
||||
import IconButton from '@mui/material/IconButton';
|
||||
import Box from '@mui/material/Box';
|
||||
import CssBaseline from '@mui/material/CssBaseline';
|
||||
import AddIcon from '@mui/icons-material/AddCircle';
|
||||
import SendIcon from '@mui/icons-material/Send';
|
||||
|
||||
import PropagateLoader from "react-spinners/PropagateLoader";
|
||||
import Markdown from 'react-markdown';
|
||||
@ -69,7 +71,7 @@ interface ControlsParams {
|
||||
toggleRag: (tool: Tool) => void,
|
||||
setRags: (rags: Tool[]) => void,
|
||||
setSystemPrompt: (prompt: string) => void,
|
||||
reset: (types: ("rags" | "tools" | "history" | "system-prompt")[]) => Promise<void>
|
||||
reset: (types: ("rags" | "tools" | "history" | "system-prompt")[], message: string) => Promise<void>
|
||||
};
|
||||
|
||||
const Controls = ({ tools, rags, systemPrompt, toggleTool, toggleRag, setSystemPrompt, reset }: ControlsParams) => {
|
||||
@ -125,7 +127,7 @@ const Controls = ({ tools, rags, systemPrompt, toggleTool, toggleRag, setSystemP
|
||||
/>
|
||||
<div style={{ display: "flex", flexDirection: "row", gap: "8px", paddingTop: "8px" }}>
|
||||
<Button variant="contained" disabled={editSystemPrompt === systemPrompt} onClick={() => { setSystemPrompt(editSystemPrompt); }}>Set</Button>
|
||||
<Button variant="outlined" onClick={() => { reset(["system-prompt"]); }} color="error">Reset</Button>
|
||||
<Button variant="outlined" onClick={() => { reset(["system-prompt"], "System prompt reset."); }} color="error">Reset</Button>
|
||||
</div>
|
||||
</AccordionActions>
|
||||
</Accordion>
|
||||
@ -173,8 +175,8 @@ const Controls = ({ tools, rags, systemPrompt, toggleTool, toggleRag, setSystemP
|
||||
}</FormGroup>
|
||||
</AccordionActions>
|
||||
</Accordion>
|
||||
<Button onClick={() => { reset(["history"]); }}>Clear Chat History</Button>
|
||||
<Button onClick={() => { reset(["rags", "tools", "system-prompt"]) }}>Reset to defaults</Button>
|
||||
<Button onClick={() => { reset(["history"], "History cleared."); }}>Clear Chat History</Button>
|
||||
<Button onClick={() => { reset(["rags", "tools", "system-prompt"], "Default settings restored.") }}>Reset to defaults</Button>
|
||||
</div>);
|
||||
}
|
||||
|
||||
@ -386,7 +388,7 @@ const App = () => {
|
||||
|
||||
}, [systemPrompt, setServerSystemPrompt, serverSystemPrompt, loc, sessionId, setSnack]);
|
||||
|
||||
const reset = async (types: ("rags" | "tools" | "history" | "system-prompt")[]) => {
|
||||
const reset = async (types: ("rags" | "tools" | "history" | "system-prompt")[], message: string = "Update successful.") => {
|
||||
try {
|
||||
const response = await fetch(getConnectionBase(loc) + `/api/reset/${sessionId}`, {
|
||||
method: 'PUT',
|
||||
@ -419,7 +421,7 @@ const App = () => {
|
||||
break;
|
||||
}
|
||||
}
|
||||
setSnack("Update successful.", "success");
|
||||
setSnack(message, "success");
|
||||
} else {
|
||||
throw Error(`${{ status: response.status, message: response.statusText }}`);
|
||||
}
|
||||
@ -477,7 +479,7 @@ const App = () => {
|
||||
type MessageList = Message[];
|
||||
|
||||
const onNew = async () => {
|
||||
reset(["rags", "tools", "history", "system-prompt"]);
|
||||
reset(["rags", "tools", "history", "system-prompt"], "New chat started.");
|
||||
}
|
||||
|
||||
const sendQuery = async () => {
|
||||
@ -643,6 +645,16 @@ const App = () => {
|
||||
>
|
||||
<MenuIcon />
|
||||
</IconButton>
|
||||
|
||||
<IconButton
|
||||
color="inherit"
|
||||
aria-label="new_chat"
|
||||
edge="start"
|
||||
onClick={onNew}
|
||||
sx={{ mr: 2 }}
|
||||
>
|
||||
<AddIcon />
|
||||
</IconButton>
|
||||
<Typography variant="h6" noWrap component="div">
|
||||
Ketr-Chat
|
||||
</Typography>
|
||||
@ -729,7 +741,7 @@ const App = () => {
|
||||
</div>
|
||||
</Box>
|
||||
|
||||
<Box className="Query" style={{ display: "flex", flexDirection: "row" }}>
|
||||
<Box className="Query" sx={{ display: "flex", flexDirection: "row", p: 1 }}>
|
||||
<TextField
|
||||
variant="outlined"
|
||||
disabled={processing}
|
||||
@ -743,8 +755,7 @@ const App = () => {
|
||||
id="QueryInput"
|
||||
/>
|
||||
<AccordionActions>
|
||||
<Button variant="contained" onClick={sendQuery}>Send</Button>
|
||||
<Button variant="outlined" onClick={onNew}>New</Button>
|
||||
<Button sx={{ m: 0 }} variant="contained" onClick={sendQuery}><SendIcon /></Button>
|
||||
</AccordionActions>
|
||||
</Box>
|
||||
</Box>
|
||||
|
@ -330,7 +330,7 @@ tools = [ {
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "get_current_datetime",
|
||||
"description": "Get the current date and time in a specified timezone",
|
||||
"description": "Get the current date and time in a specified timezone. For example if a user asks 'What time is it in Poland?' you would pass the Warsaw timezone to get_current_datetime.",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user