mirror of
https://github.com/wassname/stampy-chat.git
synced 2026-09-11 12:50:34 +08:00
pr fixes
This commit is contained in:
@@ -73,7 +73,7 @@ export const ShowCitation: React.FC<{citation: Citation}> = ({citation}) => {
|
||||
// if we don't have a url, link to a duckduckgo search for the title instead
|
||||
const url = citation.url && citation.url !== ""
|
||||
? citation.url
|
||||
: `https://duckduckgo.com/?q=${encodeURIComponent(ndecitation.title)}`;
|
||||
: `https://duckduckgo.com/?q=${encodeURIComponent(citation.title)}`;
|
||||
|
||||
return (
|
||||
<A className={Colours[(citation.index - 1) % Colours.length] + " border-2 flex items-center rounded my-2 text-sm no-underline w-fit"}
|
||||
|
||||
+23
-24
@@ -52,7 +52,7 @@ const Home: NextPage = () => {
|
||||
const [entries, setEntries] = useState<Entry[]>([]);
|
||||
const [current, setCurrent] = useState<CurrentSearch>();
|
||||
const [sessionId, setSessionId] = useState()
|
||||
const [citations, setCitations] = useState<Citation>([])
|
||||
const [citations, setCitations] = useState<Citation>([])
|
||||
|
||||
// [state, ready to save to localstorage]
|
||||
const [mode, setMode] = useState<[Mode, boolean]>(["default", false]);
|
||||
@@ -71,13 +71,12 @@ const Home: NextPage = () => {
|
||||
}, []);
|
||||
|
||||
const updateCurrent = (current: CurrentSearch) => {
|
||||
setCurrent(current);
|
||||
if (current?.phase === "streaming") {
|
||||
scroll30();
|
||||
}
|
||||
setCurrent(current);
|
||||
if (current?.phase === "streaming") {
|
||||
scroll30();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const updateCitations = (allCitations: Citation[], current: CurrentSearch) => {
|
||||
const entryCitations = Array.from(current.citationsMap.values());
|
||||
if (!entryCitations.some(c => !c.index)) {
|
||||
@@ -111,26 +110,26 @@ const Home: NextPage = () => {
|
||||
) => {
|
||||
|
||||
// clear the query box, append to entries
|
||||
const userEntry: Entry = {
|
||||
role: "user",
|
||||
content: query_source === "search" ? query : query.split("\n", 2)[1]!,
|
||||
};
|
||||
setEntries((prev) => [...prev, userEntry]);
|
||||
disable();
|
||||
const userEntry: Entry = {
|
||||
role: "user",
|
||||
content: query_source === "search" ? query : query.split("\n", 2)[1]!,
|
||||
};
|
||||
setEntries((prev) => [...prev, userEntry]);
|
||||
disable();
|
||||
|
||||
const { result, followups } = await runSearch(
|
||||
query,
|
||||
query_source,
|
||||
mode[0],
|
||||
entries,
|
||||
updateCurrent,
|
||||
sessionId,
|
||||
);
|
||||
setCurrent(undefined);
|
||||
const { result, followups } = await runSearch(
|
||||
query,
|
||||
query_source,
|
||||
mode[0],
|
||||
entries,
|
||||
updateCurrent,
|
||||
sessionId,
|
||||
);
|
||||
setCurrent(undefined);
|
||||
|
||||
setEntries((prev) => [...prev, result]);
|
||||
enable(followups || []);
|
||||
scroll30();
|
||||
setEntries((prev) => [...prev, result]);
|
||||
enable(followups || []);
|
||||
scroll30();
|
||||
};
|
||||
|
||||
var last_entry = <></>;
|
||||
|
||||
Reference in New Issue
Block a user