mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-09 19:46:37 +08:00
dev
This commit is contained in:
parent
fe7fc59d0b
commit
4b470b0497
@ -11,6 +11,7 @@ import { isMobileScreen, trimTopic } from "../utils";
|
|||||||
|
|
||||||
import Locale from "../locales";
|
import Locale from "../locales";
|
||||||
import { showToast } from "../components/ui-lib";
|
import { showToast } from "../components/ui-lib";
|
||||||
|
import { url } from "inspector";
|
||||||
|
|
||||||
export type Message = ChatCompletionResponseMessage & {
|
export type Message = ChatCompletionResponseMessage & {
|
||||||
date: string;
|
date: string;
|
||||||
@ -378,6 +379,18 @@ export const useChatStore = create<ChatStore>()(
|
|||||||
},
|
},
|
||||||
|
|
||||||
async onUserInput(content) {
|
async onUserInput(content) {
|
||||||
|
// Shopper
|
||||||
|
if (content.startsWith("page:")) {
|
||||||
|
const url = content.replace("page:", "");
|
||||||
|
const response = await fetch("http://localhost:5000/page", {
|
||||||
|
method: "post",
|
||||||
|
body: JSON.stringify({ url: url }),
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
});
|
||||||
|
const data = await response.json();
|
||||||
|
const prompt = data["result"];
|
||||||
|
content = prompt;
|
||||||
|
}
|
||||||
const userMessage: Message = createMessage({
|
const userMessage: Message = createMessage({
|
||||||
role: "user",
|
role: "user",
|
||||||
content,
|
content,
|
||||||
|
@ -150,6 +150,13 @@ export const usePromptStore = create<PromptStore>()(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// shopper
|
||||||
|
builtinPrompts[0].push({
|
||||||
|
id: Math.random(),
|
||||||
|
title: "Shopper",
|
||||||
|
content: "page:https://item.jd.com/6039832.html",
|
||||||
|
} as Prompt);
|
||||||
|
|
||||||
const userPrompts =
|
const userPrompts =
|
||||||
usePromptStore.getState().getUserPrompts() ?? [];
|
usePromptStore.getState().getUserPrompts() ?? [];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user