diff --git a/README.md b/README.md index 95f6c78..7699b78 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@ # [Chat Nio](https://chatnio.net) -👋 强大精美的 **AI聚合** 聊天平台 +🚀 强大精美的 **AI聚合** 聊天平台 -👋 Powerful and beautiful **AI Aggregation** chat platform +🚀 Powerful and beautiful **AI Aggregation** chat platform [官网](https://chatnio.net) | [开放文档](https://docs.chatnio.net) | [SDKs](https://docs.chatnio.net/kuai-su-kai-shi) | [QQ 群](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=YKcvGGlM03LYWlPk-iosqAqL4qHwOtBx&authKey=6cjCqRNKNuOUJltyo%2FNgmKm%2BS%2FUCtAyVHCnirHyxNuxGExUHsJRtlSaW1EeDxhNx&noverify=0&group_code=565902327) diff --git a/app/src/components/home/ModelSelector.tsx b/app/src/components/home/ModelSelector.tsx index 9b3ff83..9c76492 100644 --- a/app/src/components/home/ModelSelector.tsx +++ b/app/src/components/home/ModelSelector.tsx @@ -9,6 +9,7 @@ import { useEffect } from "react"; import { Model } from "../../conversation/types.ts"; import { modelEvent } from "../../events/model.ts"; import { isSubscribedSelector } from "../../store/subscription.ts"; +import {teenagerSelector} from "../../store/package.ts"; function GetModel(name: string): Model { return supportModels.find((model) => model.id === name) as Model; @@ -26,6 +27,7 @@ function ModelSelector(props: ModelSelectorProps) { const model = useSelector(selectModel); const auth = useSelector(selectAuthenticated); const subscription = useSelector(isSubscribedSelector); + const student = useSelector(teenagerSelector); useEffect(() => { if (auth && model === "gpt-3.5-turbo-0613") @@ -41,17 +43,28 @@ function ModelSelector(props: ModelSelectorProps) { }); const list = supportModels.map( - (model: Model): SelectItemProps => ({ + (model: Model): SelectItemProps => { + const array = ["gpt-4", "claude-2"]; + if (subscription && array.includes(model.id)) { + return { + name: model.id, + value: model.name, + badge: { variant: "gold", name: "plus" }, + } as SelectItemProps; + } else if (student && model.id === "claude-2") { + return { + name: model.id, + value: model.name, + badge: { variant: "gold", name: "student" }, + } as SelectItemProps; + } + + return { name: model.id, value: model.name, - badge: - model.free || (subscription && model.id === "gpt-4") - ? { - variant: model.free ? "default" : "gold", - name: model.free ? "free" : "plus", - } - : undefined, - }), + badge: model.free && { variant: "default", name: "free" } + } as SelectItemProps; + }, ); return ( diff --git a/app/src/utils.ts b/app/src/utils.ts index 80622ee..d753e8e 100644 --- a/app/src/utils.ts +++ b/app/src/utils.ts @@ -261,3 +261,12 @@ export function handleGenerationData(data: string): string { .replace(/}\s*$/g, ""); return handleLine(escapeRegExp(data), 6); } + +export function getSelectionText(): string { + if (window.getSelection) { + return window.getSelection()?.toString() || ""; + } else if (document.getSelection && document.getSelection()?.toString()) { + return document.getSelection()?.toString() || ""; + } + return ""; +}