Update package version and add hideEditAndRegenerate prop
This commit is contained in:
parent
78c44e13b0
commit
4aff7f991a
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "pageassist",
|
"name": "pageassist",
|
||||||
"displayName": "Page Assist - A Web UI for Local AI Models",
|
"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.",
|
"description": "Use your locally running AI models to assist you in your web browsing.",
|
||||||
"author": "n4ze3m",
|
"author": "n4ze3m",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -21,6 +21,7 @@ type Props = {
|
|||||||
webSearch?: {}
|
webSearch?: {}
|
||||||
isSearchingInternet?: boolean
|
isSearchingInternet?: boolean
|
||||||
sources?: any[]
|
sources?: any[]
|
||||||
|
hideEditAndRegenerate?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export const PlaygroundMessage = (props: Props) => {
|
export const PlaygroundMessage = (props: Props) => {
|
||||||
@ -130,24 +131,27 @@ export const PlaygroundMessage = (props: Props) => {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{props.currentMessageIndex === props.totalMessages - 1 && (
|
{!props.hideEditAndRegenerate &&
|
||||||
<Tooltip title="Regenerate">
|
props.currentMessageIndex === props.totalMessages - 1 && (
|
||||||
<button
|
<Tooltip title="Regenerate">
|
||||||
onClick={props.onRengerate}
|
<button
|
||||||
className="flex items-center justify-center w-6 h-6 rounded-full bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500">
|
onClick={props.onRengerate}
|
||||||
<RotateCcw className="w-3 h-3 text-gray-400 group-hover:text-gray-500" />
|
className="flex items-center justify-center w-6 h-6 rounded-full bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500">
|
||||||
</button>
|
<RotateCcw className="w-3 h-3 text-gray-400 group-hover:text-gray-500" />
|
||||||
</Tooltip>
|
</button>
|
||||||
)}
|
</Tooltip>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<Tooltip title="Edit">
|
{!props.hideEditAndRegenerate && (
|
||||||
<button
|
<Tooltip title="Edit">
|
||||||
onClick={() => setEditMode(true)}
|
<button
|
||||||
className="flex items-center justify-center w-6 h-6 rounded-full bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500">
|
onClick={() => setEditMode(true)}
|
||||||
<Pen className="w-3 h-3 text-gray-400 group-hover:text-gray-500" />
|
className="flex items-center justify-center w-6 h-6 rounded-full bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500">
|
||||||
</button>
|
<Pen className="w-3 h-3 text-gray-400 group-hover:text-gray-500" />
|
||||||
</Tooltip>
|
</button>
|
||||||
|
</Tooltip>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -26,6 +26,7 @@ export const SidePanelBody = () => {
|
|||||||
totalMessages={messages.length}
|
totalMessages={messages.length}
|
||||||
onRengerate={() => {}}
|
onRengerate={() => {}}
|
||||||
isProcessing={streaming}
|
isProcessing={streaming}
|
||||||
|
hideEditAndRegenerate
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
<div className="w-full h-32 md:h-48 flex-shrink-0"></div>
|
<div className="w-full h-32 md:h-48 flex-shrink-0"></div>
|
||||||
|
@ -1,6 +1,15 @@
|
|||||||
import { getWebSearchPrompt } from "~services/ollama"
|
import { getWebSearchPrompt } from "~services/ollama"
|
||||||
import { webSearch } from "./local-google"
|
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) => {
|
export const getSystemPromptForWeb = async (query: string) => {
|
||||||
try {
|
try {
|
||||||
const search = await webSearch(query)
|
const search = await webSearch(query)
|
||||||
@ -18,7 +27,7 @@ export const getSystemPromptForWeb = async (query: string) => {
|
|||||||
source: search.map((result) => {
|
source: search.map((result) => {
|
||||||
return {
|
return {
|
||||||
url: result.url,
|
url: result.url,
|
||||||
name: new URL(result.url).hostname,
|
name: getHostName(result.url),
|
||||||
type: "url",
|
type: "url",
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user