Skip to content

Commit

Permalink
feat: disable ai assitant
Browse files Browse the repository at this point in the history
  • Loading branch information
jingsam committed Aug 28, 2024
1 parent 5197d9c commit 051ba93
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const TextEditor = <TRow, TSummaryRow = unknown>({
const loadFullValue = () => {
if (selectedTable === undefined || project === undefined) return
if ((selectedTable as PostgresTable).primary_keys.length === 0) {
return toast('无法载入值,因为表没有主键')
return toast('无法加载值,因为表没有主键')
}

const pkMatch = (selectedTable as PostgresTable).primary_keys.reduce((a, b) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const TruncatedWarningOverlay = ({
</p>
</div>
<Button type="default" loading={isLoading} onClick={loadFullValue}>
载入完整值
加载完整值
</Button>
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ const MonacoEditor = ({
defaultLanguage="pgsql"
defaultValue={snippet?.snippet.content.sql}
path={id}
loading={'加载中...'}
options={{
tabSize: 2,
fontSize: 13,
Expand Down
10 changes: 5 additions & 5 deletions apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ const SQLEditor = () => {
// entire error body from the assistant
if (isError(error)) {
toast.error(
`抱歉,助理未能成功调试您的查询!请尝试使用不同的查询。`
`抱歉,AI 助理未能成功调试您的查询!请尝试使用不同的查询。`
)
}
}
Expand Down Expand Up @@ -665,7 +665,7 @@ const SQLEditor = () => {
)}
<ResizablePanel collapsible collapsedSize={10} minSize={20}>
<div className="flex-grow overflow-y-auto border-b h-full">
{false && (
{/* {!isAiOpen && (
<motion.button
layoutId="ask-ai-input-icon"
transition={{ duration: 0.1 }}
Expand All @@ -676,7 +676,7 @@ const SQLEditor = () => {
>
<AiIconAnimation loading={false} allowHoverEffect />
</motion.button>
)}
)} */}

{isLoading ? (
<div className="flex h-full w-full items-center justify-center">
Expand Down Expand Up @@ -750,7 +750,7 @@ const SQLEditor = () => {
</ResizablePanel>
</ResizablePanelGroup>
</ResizablePanel>
<ResizableHandle withHandle />
{/* <ResizableHandle withHandle />
<ResizablePanel
ref={aiPanelRef}
collapsible
Expand All @@ -767,7 +767,7 @@ const SQLEditor = () => {
onDiff={updateEditorWithCheckForDiff}
onClose={() => aiPanelRef.current?.collapse()}
/>
</ResizablePanel>
</ResizablePanel> */}
</ResizablePanelGroup>
</>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export const SQLEditorNavV1 = ({

{isError && (
<div className="px-4">
<AlertError error={error as ResponseError} subject="载入 SQL 代码段失败" />
<AlertError error={error as ResponseError} subject="加载 SQL 代码段失败" />
</div>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function useSnippetCommands() {
[
{
id: 'run-snippet',
name: 'Run snippet',
name: '执行代码段',
icon: () => <Code />,
action: () => setPage(SNIPPET_PAGE_NAME),
},
Expand Down Expand Up @@ -116,7 +116,7 @@ function LoadingState() {
<div className="p-6">
<p className="text-center">
<Loader2 className="inline-block mr-2 animate-spin" />
Loading...
加载中...
</p>
</div>
)
Expand All @@ -127,7 +127,7 @@ function ErrorState() {
<div className="p-6">
<p className="text-center">
<AlertTriangle className="inline-block mr-2" />
Couldn&apos;t load snippets
无法加载代码段
</p>
</div>
)
Expand All @@ -144,15 +144,15 @@ function EmptyState({

return (
<div className="p-6">
<p className="mb-2 text-center">No snippets found.</p>
<p className="mb-2 text-center">未找到代码段</p>
<CommandList_Shadcn_ className="py-2">
<CommandGroup_Shadcn_>
<CommandItem_Shadcn_
id="create-snippet"
className={generateCommandClassNames(false)}
onSelect={() => router.push(`/project/${projectRef ?? '_'}/sql/new`)}
>
{canCreateNew ? 'Create new snippet' : 'Run new SQL'}
{canCreateNew ? '新建代码段' : '执行新的 SQL'}
</CommandItem_Shadcn_>
</CommandGroup_Shadcn_>
</CommandList_Shadcn_>
Expand Down Expand Up @@ -207,7 +207,7 @@ function SnippetSelector({
onSelect={() => router.push(`/project/${projectRef ?? '_'}/sql/new`)}
forceMount={true}
>
Create new snippet
新建代码段
</CommandItem_Shadcn_>
</CommandGroup_Shadcn_>
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/studio/components/ui/SqlEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const SqlEditor = ({
})
}

const Loading = () => <h4 className="text-lg">Loading</h4>
const Loading = () => <h4 className="text-lg">加载中</h4>

return (
<Editor
Expand Down
2 changes: 1 addition & 1 deletion apps/studio/tests/pages/projects/logs-query.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ test.skip('custom sql querying', async () => {
await expect(screen.findByText(/元数据/)).rejects.toThrow()

// should not see chronological features
await expect(screen.findByText(/载入旧的/)).rejects.toThrow()
await expect(screen.findByText(/加载更多/)).rejects.toThrow()
})

test.skip('bug: can edit query after selecting a log', async () => {
Expand Down

0 comments on commit 051ba93

Please sign in to comment.