mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-02 03:55:55 +00:00
perf(retrieve): ui
This commit is contained in:
@@ -37,6 +37,7 @@ export default function KBRetrieve({ kbId }: KBRetrieveProps) {
|
||||
|
||||
setLoading(true);
|
||||
try {
|
||||
setResults([]);
|
||||
const response = await httpClient.retrieveKnowledgeBase(kbId, query);
|
||||
setResults(response.results);
|
||||
} catch (error) {
|
||||
@@ -62,20 +63,19 @@ export default function KBRetrieve({ kbId }: KBRetrieveProps) {
|
||||
onKeyPress={(e) => e.key === 'Enter' && handleRetrieve()}
|
||||
/>
|
||||
<Button onClick={handleRetrieve} disabled={loading || !query.trim()}>
|
||||
{loading ? t('common.loading') : t('knowledge.query')}
|
||||
{t('knowledge.query')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="space-y-3">
|
||||
<h3 className="text-lg font-semibold">
|
||||
{t('knowledge.retrieveResults')} ({results.length})
|
||||
</h3>
|
||||
|
||||
{results.length === 0 && !loading && (
|
||||
<p className="text-muted-foreground">{t('knowledge.noResults')}</p>
|
||||
)}
|
||||
|
||||
{results.map((result) => (
|
||||
{loading ? (
|
||||
<p className="text-muted-foreground">{t('common.loading')}</p>
|
||||
) : (
|
||||
results.map((result) => (
|
||||
<Card key={result.id} className="w-full">
|
||||
<CardHeader className="pb-3">
|
||||
<CardTitle className="text-sm font-medium flex justify-between items-center">
|
||||
@@ -91,7 +91,8 @@ export default function KBRetrieve({ kbId }: KBRetrieveProps) {
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
))}
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -40,6 +40,7 @@ const enUS = {
|
||||
copySuccess: 'Copy Successfully',
|
||||
test: 'Test',
|
||||
forgotPassword: 'Forgot Password?',
|
||||
loading: 'Loading...',
|
||||
},
|
||||
notFound: {
|
||||
title: 'Page not found',
|
||||
@@ -286,7 +287,6 @@ const enUS = {
|
||||
retrieveTest: 'Retrieve Test',
|
||||
query: 'Query',
|
||||
queryPlaceholder: 'Enter query text...',
|
||||
retrieveResults: 'Retrieve Results',
|
||||
distance: 'Distance',
|
||||
content: 'Content',
|
||||
fileName: 'File Name',
|
||||
|
||||
@@ -41,6 +41,7 @@ const jaJP = {
|
||||
copySuccess: 'コピーに成功しました',
|
||||
test: 'テスト',
|
||||
forgotPassword: 'パスワードを忘れた?',
|
||||
loading: '読み込み中...',
|
||||
},
|
||||
notFound: {
|
||||
title: 'ページが見つかりません',
|
||||
@@ -285,6 +286,15 @@ const jaJP = {
|
||||
},
|
||||
deleteKnowledgeBaseConfirmation:
|
||||
'本当にこの知識ベースを削除しますか?この知識ベースに紐付けられたドキュメントは削除されます。',
|
||||
retrieve: '検索テスト',
|
||||
retrieveTest: '検索テスト',
|
||||
query: '検索',
|
||||
queryPlaceholder: '検索内容を入力...',
|
||||
distance: '距離',
|
||||
content: '内容',
|
||||
fileName: 'ファイル名',
|
||||
noResults: '検索結果がありません',
|
||||
retrieveError: '検索に失敗しました',
|
||||
},
|
||||
register: {
|
||||
title: 'LangBot を初期化 👋',
|
||||
|
||||
@@ -40,6 +40,7 @@ const zhHans = {
|
||||
copySuccess: '复制成功',
|
||||
test: '测试',
|
||||
forgotPassword: '忘记密码?',
|
||||
loading: '加载中...',
|
||||
},
|
||||
notFound: {
|
||||
title: '页面不存在',
|
||||
@@ -278,7 +279,6 @@ const zhHans = {
|
||||
retrieveTest: '检索测试',
|
||||
query: '查询',
|
||||
queryPlaceholder: '输入查询内容...',
|
||||
retrieveResults: '检索结果',
|
||||
distance: '距离',
|
||||
content: '内容',
|
||||
fileName: '文件名',
|
||||
|
||||
Reference in New Issue
Block a user