fix: model selection
This commit is contained in:
@@ -55,6 +55,8 @@
|
|||||||
right: 0;
|
right: 0;
|
||||||
margin-top: 4px;
|
margin-top: 4px;
|
||||||
min-width: 160px;
|
min-width: 160px;
|
||||||
|
max-height: 300px;
|
||||||
|
overflow-y: auto;
|
||||||
background-color: var(--vscode-dropdown-background);
|
background-color: var(--vscode-dropdown-background);
|
||||||
border: 1px solid var(--vscode-dropdown-border);
|
border: 1px solid var(--vscode-dropdown-border);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export const ChatPanel: React.FC<ChatPanelProps> = ({ conversationId }) => {
|
|||||||
// Load conversation and messages
|
// Load conversation and messages
|
||||||
const loadData = useCallback(async () => {
|
const loadData = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
const [conv, msgs, models] = await Promise.all([
|
const [conv, msgs, modelsResult] = await Promise.all([
|
||||||
window.electronAPI?.chat.getConversation(conversationId),
|
window.electronAPI?.chat.getConversation(conversationId),
|
||||||
window.electronAPI?.chat.getHistory(conversationId),
|
window.electronAPI?.chat.getHistory(conversationId),
|
||||||
window.electronAPI?.chat.getAvailableModels()
|
window.electronAPI?.chat.getAvailableModels()
|
||||||
@@ -52,7 +52,7 @@ export const ChatPanel: React.FC<ChatPanelProps> = ({ conversationId }) => {
|
|||||||
|
|
||||||
if (conv) setConversation(conv);
|
if (conv) setConversation(conv);
|
||||||
if (msgs) setMessages(msgs);
|
if (msgs) setMessages(msgs);
|
||||||
if (models) setAvailableModels(models);
|
if (modelsResult?.models) setAvailableModels(modelsResult.models);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to load chat data:', error);
|
console.error('Failed to load chat data:', error);
|
||||||
}
|
}
|
||||||
|
|||||||
2
src/renderer/types/electron.d.ts
vendored
2
src/renderer/types/electron.d.ts
vendored
@@ -341,7 +341,7 @@ export interface ElectronAPI {
|
|||||||
getApiKey: () => Promise<ChatApiKeyStatus>;
|
getApiKey: () => Promise<ChatApiKeyStatus>;
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
getAvailableModels: () => Promise<ChatModel[]>;
|
getAvailableModels: () => Promise<{ success: boolean; models?: ChatModel[]; selectedModel?: string; error?: string }>;
|
||||||
setDefaultModel: (modelId: string) => Promise<void>;
|
setDefaultModel: (modelId: string) => Promise<void>;
|
||||||
getSystemPrompt: () => Promise<string | null>;
|
getSystemPrompt: () => Promise<string | null>;
|
||||||
setSystemPrompt: (prompt: string) => Promise<void>;
|
setSystemPrompt: (prompt: string) => Promise<void>;
|
||||||
|
|||||||
Reference in New Issue
Block a user