mirror of
https://github.com/coaidev/coai.git
synced 2025-05-20 21:40:15 +09:00
update
This commit is contained in:
parent
0b34d566fe
commit
67b574033b
@ -4,9 +4,9 @@
|
|||||||
|
|
||||||
# [Chat Nio](https://chatnio.net)
|
# [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)
|
[官网](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)
|
||||||
|
@ -9,6 +9,7 @@ import { useEffect } from "react";
|
|||||||
import { Model } from "../../conversation/types.ts";
|
import { Model } from "../../conversation/types.ts";
|
||||||
import { modelEvent } from "../../events/model.ts";
|
import { modelEvent } from "../../events/model.ts";
|
||||||
import { isSubscribedSelector } from "../../store/subscription.ts";
|
import { isSubscribedSelector } from "../../store/subscription.ts";
|
||||||
|
import {teenagerSelector} from "../../store/package.ts";
|
||||||
|
|
||||||
function GetModel(name: string): Model {
|
function GetModel(name: string): Model {
|
||||||
return supportModels.find((model) => model.id === name) as Model;
|
return supportModels.find((model) => model.id === name) as Model;
|
||||||
@ -26,6 +27,7 @@ function ModelSelector(props: ModelSelectorProps) {
|
|||||||
const model = useSelector(selectModel);
|
const model = useSelector(selectModel);
|
||||||
const auth = useSelector(selectAuthenticated);
|
const auth = useSelector(selectAuthenticated);
|
||||||
const subscription = useSelector(isSubscribedSelector);
|
const subscription = useSelector(isSubscribedSelector);
|
||||||
|
const student = useSelector(teenagerSelector);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (auth && model === "gpt-3.5-turbo-0613")
|
if (auth && model === "gpt-3.5-turbo-0613")
|
||||||
@ -41,17 +43,28 @@ function ModelSelector(props: ModelSelectorProps) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const list = supportModels.map(
|
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,
|
name: model.id,
|
||||||
value: model.name,
|
value: model.name,
|
||||||
badge:
|
badge: model.free && { variant: "default", name: "free" }
|
||||||
model.free || (subscription && model.id === "gpt-4")
|
} as SelectItemProps;
|
||||||
? {
|
},
|
||||||
variant: model.free ? "default" : "gold",
|
|
||||||
name: model.free ? "free" : "plus",
|
|
||||||
}
|
|
||||||
: undefined,
|
|
||||||
}),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -261,3 +261,12 @@ export function handleGenerationData(data: string): string {
|
|||||||
.replace(/}\s*$/g, "");
|
.replace(/}\s*$/g, "");
|
||||||
return handleLine(escapeRegExp(data), 6);
|
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 "";
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user