Spaces:
Paused
Paused
Upload 391 files
Browse files- app/components/search-chat.tsx +7 -7
- app/locales/cn.ts +1 -0
- app/locales/en.ts +1 -0
app/components/search-chat.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import { useState, useEffect, useRef, useCallback } from "react";
|
| 2 |
import { ErrorBoundary } from "./error";
|
| 3 |
import styles from "./mask.module.scss";
|
| 4 |
import { useNavigate } from "react-router-dom";
|
|
@@ -8,7 +8,7 @@ import EyeIcon from "../icons/eye.svg";
|
|
| 8 |
import Locale from "../locales";
|
| 9 |
import { Path } from "../constant";
|
| 10 |
|
| 11 |
-
import { useChatStore } from "../store";
|
| 12 |
|
| 13 |
type Item = {
|
| 14 |
id: number;
|
|
@@ -31,12 +31,12 @@ export function SearchChatPage() {
|
|
| 31 |
const lowerCaseText = text.toLowerCase();
|
| 32 |
const results: Item[] = [];
|
| 33 |
|
| 34 |
-
sessions.forEach((session, index) => {
|
| 35 |
const fullTextContents: string[] = [];
|
| 36 |
|
| 37 |
-
session.messages.forEach((message) => {
|
| 38 |
const content = message.content as string;
|
| 39 |
-
if (!content
|
| 40 |
const lowerCaseContent = content.toLowerCase();
|
| 41 |
|
| 42 |
// full text search
|
|
@@ -119,7 +119,7 @@ export function SearchChatPage() {
|
|
| 119 |
placeholder={Locale.SearchChat.Page.Search}
|
| 120 |
autoFocus
|
| 121 |
ref={searchInputRef}
|
| 122 |
-
onKeyDown={(e) => {
|
| 123 |
if (e.key === "Enter") {
|
| 124 |
e.preventDefault();
|
| 125 |
const searchText = e.currentTarget.value;
|
|
@@ -133,7 +133,7 @@ export function SearchChatPage() {
|
|
| 133 |
</div>
|
| 134 |
|
| 135 |
<div>
|
| 136 |
-
{searchResults.map((item) => (
|
| 137 |
<div
|
| 138 |
className={styles["mask-item"]}
|
| 139 |
key={item.id}
|
|
|
|
| 1 |
+
import React, { useState, useEffect, useRef, useCallback } from "react";
|
| 2 |
import { ErrorBoundary } from "./error";
|
| 3 |
import styles from "./mask.module.scss";
|
| 4 |
import { useNavigate } from "react-router-dom";
|
|
|
|
| 8 |
import Locale from "../locales";
|
| 9 |
import { Path } from "../constant";
|
| 10 |
|
| 11 |
+
import { useChatStore, type ChatSession, type ChatMessage } from "../store";
|
| 12 |
|
| 13 |
type Item = {
|
| 14 |
id: number;
|
|
|
|
| 31 |
const lowerCaseText = text.toLowerCase();
|
| 32 |
const results: Item[] = [];
|
| 33 |
|
| 34 |
+
sessions.forEach((session: ChatSession, index: number) => {
|
| 35 |
const fullTextContents: string[] = [];
|
| 36 |
|
| 37 |
+
session.messages.forEach((message: ChatMessage) => {
|
| 38 |
const content = message.content as string;
|
| 39 |
+
if (!content?.toLowerCase || content === "") return;
|
| 40 |
const lowerCaseContent = content.toLowerCase();
|
| 41 |
|
| 42 |
// full text search
|
|
|
|
| 119 |
placeholder={Locale.SearchChat.Page.Search}
|
| 120 |
autoFocus
|
| 121 |
ref={searchInputRef}
|
| 122 |
+
onKeyDown={(e: React.KeyboardEvent<HTMLInputElement>) => {
|
| 123 |
if (e.key === "Enter") {
|
| 124 |
e.preventDefault();
|
| 125 |
const searchText = e.currentTarget.value;
|
|
|
|
| 133 |
</div>
|
| 134 |
|
| 135 |
<div>
|
| 136 |
+
{searchResults.map((item: Item) => (
|
| 137 |
<div
|
| 138 |
className={styles["mask-item"]}
|
| 139 |
key={item.id}
|
app/locales/cn.ts
CHANGED
|
@@ -540,6 +540,7 @@ const cn = {
|
|
| 540 |
NotSupported: "此供应商不支持列出自定义模型。",
|
| 541 |
Fetch: "获取模型列表",
|
| 542 |
Success: "成功获取列表。",
|
|
|
|
| 543 |
},
|
| 544 |
},
|
| 545 |
|
|
|
|
| 540 |
NotSupported: "此供应商不支持列出自定义模型。",
|
| 541 |
Fetch: "获取模型列表",
|
| 542 |
Success: "成功获取列表。",
|
| 543 |
+
NoModels: "未找到模型。",
|
| 544 |
},
|
| 545 |
},
|
| 546 |
|
app/locales/en.ts
CHANGED
|
@@ -524,6 +524,7 @@ const en: LocaleType = {
|
|
| 524 |
NotSupported: "This provider does not support listing custom models.",
|
| 525 |
Fetch: "Fetch Models",
|
| 526 |
Success: "Fetched successfully.",
|
|
|
|
| 527 |
},
|
| 528 |
Google: {
|
| 529 |
ApiKey: {
|
|
|
|
| 524 |
NotSupported: "This provider does not support listing custom models.",
|
| 525 |
Fetch: "Fetch Models",
|
| 526 |
Success: "Fetched successfully.",
|
| 527 |
+
NoModels: "No models found.",
|
| 528 |
},
|
| 529 |
Google: {
|
| 530 |
ApiKey: {
|