From ebbf9e4f7ca1a3aa965611a1785ef2e2165acdf5 Mon Sep 17 00:00:00 2001 From: sijinhui Date: Tue, 14 May 2024 17:28:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/chat.tsx | 3 ++- app/components/ui-lib.tsx | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/app/components/chat.tsx b/app/components/chat.tsx index 6859e0e13..10967b907 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -78,6 +78,7 @@ import { List, ListItem, Modal, + ModalSelector, Selector, showConfirm, showPrompt, @@ -606,7 +607,7 @@ export function ChatActions(props: { {/*/>*/} {showModelSelector && ( - ({ title: m.displayName, diff --git a/app/components/ui-lib.tsx b/app/components/ui-lib.tsx index da700c0fb..838b15344 100644 --- a/app/components/ui-lib.tsx +++ b/app/components/ui-lib.tsx @@ -15,6 +15,7 @@ import Locale from "../locales"; import { createRoot } from "react-dom/client"; import React, { HTMLProps, useEffect, useState } from "react"; import { IconButton } from "./button"; +import { Card as AntCard, List as AntList, Row, Col, Grid } from "antd"; export function Popover(props: { children: JSX.Element; @@ -485,3 +486,35 @@ export function Selector(props: { ); } + +export function ModalSelector(props: { + items: Array<{ + title: string; + subTitle?: string; + value: T; + }>; + defaultSelectedValue?: T; + onSelection?: (selection: T[]) => void; + onClose?: () => void; + multiple?: boolean; +}) { + console.log("-----", props); + + return ( +
+ props.onClose?.()}> + + + + Card + + + + + Card + + + +
+ ); +}