fix: ai gen minor fixes (#2626)
This commit is contained in:
@@ -373,7 +373,7 @@
|
||||
|
||||
const thisTs = Date.now()
|
||||
copilotTs = thisTs
|
||||
await sleep(500)
|
||||
await sleep(200)
|
||||
if (copilotTs === thisTs) {
|
||||
abortController?.abort()
|
||||
abortController = new AbortController()
|
||||
|
||||
@@ -659,6 +659,7 @@
|
||||
$copilotDrawerStore?.closeDrawer()
|
||||
select(module.id)
|
||||
await tick()
|
||||
await tick()
|
||||
focusCopilot()
|
||||
|
||||
let isFirstInLoop = false
|
||||
@@ -675,7 +676,6 @@
|
||||
if (hubScript) {
|
||||
module.editor?.setCode(hubScript.content)
|
||||
} else if (module.source === 'custom') {
|
||||
module.editor?.setCode('')
|
||||
const deltaStore = writable<string>('')
|
||||
const unsubscribe = deltaStore.subscribe(async (delta) => {
|
||||
module.editor?.append(delta)
|
||||
|
||||
@@ -145,6 +145,16 @@
|
||||
}
|
||||
|
||||
$: updateSchema(lang, args, $dbSchemas)
|
||||
|
||||
let codeDiv: HTMLDivElement | undefined
|
||||
let lastScrollHeight = 0
|
||||
function updateScroll() {
|
||||
if (codeDiv && lastScrollHeight !== codeDiv.scrollHeight) {
|
||||
codeDiv.scrollTop = codeDiv.scrollHeight
|
||||
lastScrollHeight = codeDiv.scrollHeight
|
||||
}
|
||||
}
|
||||
$: $generatedCode && updateScroll()
|
||||
</script>
|
||||
|
||||
{#if genLoading}
|
||||
@@ -264,7 +274,7 @@
|
||||
</svelte:fragment>
|
||||
<div class="block text-primary">
|
||||
{#if genLoading}
|
||||
<div class="w-[42rem] min-h-[3rem] max-h-[34rem] overflow-y-scroll">
|
||||
<div class="w-[42rem] min-h-[3rem] max-h-[34rem] overflow-y-scroll" bind:this={codeDiv}>
|
||||
{#if $generatedCode.length > 0}
|
||||
<div class="overflow-x-scroll">
|
||||
<HighlightCode language={lang} code={$generatedCode} /></div
|
||||
|
||||
@@ -132,7 +132,8 @@ async function getResourceTypes(scriptOptions: CopilotOptions) {
|
||||
|
||||
const resourceTypes = await ResourceService.queryResourceTypes({
|
||||
workspace,
|
||||
text: elems.join(';')
|
||||
text: elems.join(';'),
|
||||
limit: 3
|
||||
})
|
||||
|
||||
return resourceTypes
|
||||
|
||||
Reference in New Issue
Block a user