mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-30 05:43:55 +00:00
app: inherit owner when creating prompt session
This commit is contained in:
parent
b07b5a9b7f
commit
0afeaea21f
@ -1,10 +1,10 @@
|
|||||||
import { createStore, type SetStoreFunction } from "solid-js/store"
|
|
||||||
import { createSimpleContext } from "@opencode-ai/ui/context"
|
import { createSimpleContext } from "@opencode-ai/ui/context"
|
||||||
import { batch, createMemo, createRoot, onCleanup } from "solid-js"
|
import { checksum } from "@opencode-ai/util/encode"
|
||||||
import { useParams } from "@solidjs/router"
|
import { useParams } from "@solidjs/router"
|
||||||
|
import { batch, createMemo, createRoot, getOwner, onCleanup } from "solid-js"
|
||||||
|
import { createStore, type SetStoreFunction } from "solid-js/store"
|
||||||
import type { FileSelection } from "@/context/file"
|
import type { FileSelection } from "@/context/file"
|
||||||
import { Persist, persisted } from "@/utils/persist"
|
import { Persist, persisted } from "@/utils/persist"
|
||||||
import { checksum } from "@opencode-ai/util/encode"
|
|
||||||
|
|
||||||
interface PartBase {
|
interface PartBase {
|
||||||
content: string
|
content: string
|
||||||
@ -250,6 +250,7 @@ export const { use: usePrompt, provider: PromptProvider } = createSimpleContext(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const owner = getOwner()
|
||||||
const load = (dir: string, id: string | undefined) => {
|
const load = (dir: string, id: string | undefined) => {
|
||||||
const key = `${dir}:${id ?? WORKSPACE_KEY}`
|
const key = `${dir}:${id ?? WORKSPACE_KEY}`
|
||||||
const existing = cache.get(key)
|
const existing = cache.get(key)
|
||||||
@ -259,10 +260,13 @@ export const { use: usePrompt, provider: PromptProvider } = createSimpleContext(
|
|||||||
return existing.value
|
return existing.value
|
||||||
}
|
}
|
||||||
|
|
||||||
const entry = createRoot((dispose) => ({
|
const entry = createRoot(
|
||||||
value: createPromptSession(dir, id),
|
(dispose) => ({
|
||||||
dispose,
|
value: createPromptSession(dir, id),
|
||||||
}))
|
dispose,
|
||||||
|
}),
|
||||||
|
owner,
|
||||||
|
)
|
||||||
|
|
||||||
cache.set(key, entry)
|
cache.set(key, entry)
|
||||||
prune()
|
prune()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user