Update package version and add hideEditAndRegenerate prop

This commit is contained in:
n4ze3m 2024-03-16 14:28:32 +05:30
parent 78c44e13b0
commit 4aff7f991a
4 changed files with 32 additions and 18 deletions

View File

@ -1,7 +1,7 @@
{
"name": "pageassist",
"displayName": "Page Assist - A Web UI for Local AI Models",
"version": "1.0.8",
"version": "1.0.9",
"description": "Use your locally running AI models to assist you in your web browsing.",
"author": "n4ze3m",
"scripts": {

View File

@ -21,6 +21,7 @@ type Props = {
webSearch?: {}
isSearchingInternet?: boolean
sources?: any[]
hideEditAndRegenerate?: boolean
}
export const PlaygroundMessage = (props: Props) => {
@ -130,7 +131,8 @@ export const PlaygroundMessage = (props: Props) => {
</Tooltip>
)}
{props.currentMessageIndex === props.totalMessages - 1 && (
{!props.hideEditAndRegenerate &&
props.currentMessageIndex === props.totalMessages - 1 && (
<Tooltip title="Regenerate">
<button
onClick={props.onRengerate}
@ -141,6 +143,7 @@ export const PlaygroundMessage = (props: Props) => {
)}
</>
)}
{!props.hideEditAndRegenerate && (
<Tooltip title="Edit">
<button
onClick={() => setEditMode(true)}
@ -148,6 +151,7 @@ export const PlaygroundMessage = (props: Props) => {
<Pen className="w-3 h-3 text-gray-400 group-hover:text-gray-500" />
</button>
</Tooltip>
)}
</div>
)}
</div>

View File

@ -26,6 +26,7 @@ export const SidePanelBody = () => {
totalMessages={messages.length}
onRengerate={() => {}}
isProcessing={streaming}
hideEditAndRegenerate
/>
))}
<div className="w-full h-32 md:h-48 flex-shrink-0"></div>

View File

@ -1,6 +1,15 @@
import { getWebSearchPrompt } from "~services/ollama"
import { webSearch } from "./local-google"
const getHostName = (url: string) => {
try {
const hostname = new URL(url).hostname
return hostname
} catch (e) {
return ""
}
}
export const getSystemPromptForWeb = async (query: string) => {
try {
const search = await webSearch(query)
@ -18,7 +27,7 @@ export const getSystemPromptForWeb = async (query: string) => {
source: search.map((result) => {
return {
url: result.url,
name: new URL(result.url).hostname,
name: getHostName(result.url),
type: "url",
}
})