app: wrap provider data in Map to avoid store (#28765)
This commit is contained in:
@@ -1063,7 +1063,7 @@ export function UserMessageDisplay(props: { message: UserMessage; parts: PartTyp
|
||||
const providerID = props.message.model?.providerID
|
||||
const modelID = props.message.model?.modelID
|
||||
if (!providerID || !modelID) return ""
|
||||
const match = data.store.provider?.all?.find((p) => p.id === providerID)
|
||||
const match = data.store.provider?.all?.get(providerID)
|
||||
return match?.models?.[modelID]?.name ?? modelID
|
||||
})
|
||||
const timefmt = createMemo(() => new Intl.DateTimeFormat(i18n.locale(), { timeStyle: "short" }))
|
||||
@@ -1458,7 +1458,7 @@ PART_MAPPING["text"] = function TextPartDisplay(props) {
|
||||
const model = createMemo(() => {
|
||||
if (props.message.role !== "assistant") return ""
|
||||
const message = props.message as AssistantMessage
|
||||
const match = data.store.provider?.all?.find((p) => p.id === message.providerID)
|
||||
const match = data.store.provider?.all?.get(message.providerID)
|
||||
return match?.models?.[message.modelID]?.name ?? message.modelID
|
||||
})
|
||||
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
import type { Message, Session, Part, SnapshotFileDiff, SessionStatus, ProviderListResponse } from "@opencode-ai/sdk/v2"
|
||||
import type { Message, Session, Part, SnapshotFileDiff, SessionStatus, Provider } from "@opencode-ai/sdk/v2"
|
||||
import { createSimpleContext } from "./helper"
|
||||
import { PreloadMultiFileDiffResult } from "@pierre/diffs/ssr"
|
||||
|
||||
export type NormalizedProviderListResponse = {
|
||||
all: Map<string, Provider>
|
||||
default: {
|
||||
[key: string]: string
|
||||
}
|
||||
connected: Array<string>
|
||||
}
|
||||
|
||||
type Data = {
|
||||
agent?: {
|
||||
name: string
|
||||
color?: string
|
||||
}[]
|
||||
provider?: ProviderListResponse
|
||||
provider?: NormalizedProviderListResponse
|
||||
session: Session[]
|
||||
session_status: {
|
||||
[sessionID: string]: SessionStatus
|
||||
|
||||
Reference in New Issue
Block a user