update generation link

This commit is contained in:
Zhang Minghan 2023-09-20 22:11:18 +08:00
parent e7eefa816c
commit f23a2fd162
6 changed files with 42 additions and 6 deletions

View File

@ -13,7 +13,7 @@
.scroll-action { .scroll-action {
position: absolute; position: absolute;
z-index: 64; z-index: 12;
bottom: 112px; bottom: 112px;
right: 36px; right: 36px;
opacity: 0; opacity: 0;

View File

@ -63,7 +63,7 @@
} }
} }
.input-box { .generate-box {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
width: 80%; width: 80%;

View File

@ -228,6 +228,17 @@
} }
} }
.chat-product {
display: flex;
flex-direction: column;
gap: 12px;
flex-grow: 1;
width: 100%;
overflow: hidden;
justify-content: center;
align-items: center;
}
.chat-content { .chat-content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View File

@ -144,6 +144,10 @@ const resources = {
"max-length-prompt": "max-length-prompt":
"The content has been truncated due to the context length limit", "The content has been truncated due to the context length limit",
}, },
"generate": {
"title": "AI Project Generator",
"input-placeholder": "generate a python game",
}
}, },
}, },
cn: { cn: {
@ -275,6 +279,10 @@ const resources = {
"max-length": "内容过长", "max-length": "内容过长",
"max-length-prompt": "由于上下文长度限制,内容已被截取", "max-length-prompt": "由于上下文长度限制,内容已被截取",
}, },
"generate": {
"title": "AI 项目生成器",
"input-placeholder": "生成一个python小游戏",
}
}, },
}, },
ru: { ru: {
@ -416,6 +424,10 @@ const resources = {
"max-length-prompt": "max-length-prompt":
"Содержимое было усечено из-за ограничения длины контекста", "Содержимое было усечено из-за ограничения длины контекста",
}, },
generate: {
title: "Генератор AI проектов",
"input-placeholder": "сгенерировать python игру",
}
}, },
}, },
}; };

View File

@ -15,6 +15,7 @@ type WrapperProps = {
}; };
function Wrapper(props: WrapperProps) { function Wrapper(props: WrapperProps) {
const { t } = useTranslation();
const ref = useRef(null); const ref = useRef(null);
const [model, setModel] = useState("GPT-3.5"); const [model, setModel] = useState("GPT-3.5");
@ -45,8 +46,8 @@ function Wrapper(props: WrapperProps) {
<img src={`/favicon.ico`} alt={""} /> <img src={`/favicon.ico`} alt={""} />
AI Code Generator AI Code Generator
</div> </div>
<div className={`input-box`}> <div className={`generate-box`}>
<Input className={`input`} ref={ref} /> <Input className={`input`} ref={ref} placeholder={t('generate.input-placeholder')} />
<Button <Button
size={`icon`} size={`icon`}
className={`action`} className={`action`}

View File

@ -3,7 +3,7 @@ import "../assets/chat.less";
import { Input } from "../components/ui/input.tsx"; import { Input } from "../components/ui/input.tsx";
import { Toggle } from "../components/ui/toggle.tsx"; import { Toggle } from "../components/ui/toggle.tsx";
import { import {
ChevronDown, ChevronDown, ChevronRight, FolderKanban,
Globe, Globe,
LogIn, LogIn,
MessageSquare, MessageSquare,
@ -63,6 +63,7 @@ import { useTranslation } from "react-i18next";
import MessageSegment from "../components/Message.tsx"; import MessageSegment from "../components/Message.tsx";
import { setMenu } from "../store/menu.ts"; import { setMenu } from "../store/menu.ts";
import FileProvider, { FileObject } from "../components/FileProvider.tsx"; import FileProvider, { FileObject } from "../components/FileProvider.tsx";
import router from "../router.ts";
function SideBar() { function SideBar() {
const { t } = useTranslation(); const { t } = useTranslation();
@ -282,6 +283,7 @@ function ChatWrapper() {
const auth = useSelector(selectAuthenticated); const auth = useSelector(selectAuthenticated);
const gpt4 = useSelector(selectGPT4); const gpt4 = useSelector(selectGPT4);
const web = useSelector(selectWeb); const web = useSelector(selectWeb);
const messages = useSelector(selectMessages);
const target = useRef(null); const target = useRef(null);
manager.setDispatch(dispatch); manager.setDispatch(dispatch);
@ -310,7 +312,17 @@ function ChatWrapper() {
return ( return (
<div className={`chat-container`}> <div className={`chat-container`}>
<div className={`chat-wrapper`}> <div className={`chat-wrapper`}>
<ChatInterface /> {
messages.length > 0 ?
<ChatInterface /> :
<div className={`chat-product`}>
<Button variant={`outline`} onClick={() => router.navigate('/generate')}>
<FolderKanban className={`h-4 w-4 mr-1.5`} />
{ t('generate.title') }
<ChevronRight className={`h-4 w-4 ml-2`} />
</Button>
</div>
}
<div className={`chat-input`}> <div className={`chat-input`}>
<div className={`input-wrapper`}> <div className={`input-wrapper`}>
<TooltipProvider> <TooltipProvider>