mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 04:30:48 +00:00
Introduce a config module to manage configuration (#22)
* Introduce a config module to manage configuration * Remove public modifier
This commit is contained in:
parent
e1fac40256
commit
3afaa8033b
10 changed files with 131 additions and 174 deletions
|
|
@ -1,7 +1,9 @@
|
|||
import React from 'react';
|
||||
import { Box, Text } from 'ink';
|
||||
import TextInput from 'ink-text-input';
|
||||
import { getModel } from '../../config/globalConfig.js';
|
||||
import { globalConfig } from '../../config/config.js';
|
||||
|
||||
|
||||
|
||||
interface InputPromptProps {
|
||||
query: string;
|
||||
|
|
@ -15,7 +17,7 @@ const InputPrompt: React.FC<InputPromptProps> = ({
|
|||
setQuery,
|
||||
onSubmit,
|
||||
}) => {
|
||||
const model = getModel();
|
||||
const model = globalConfig.getModel();
|
||||
|
||||
return (
|
||||
<Box marginTop={1} borderStyle="round" borderColor={'white'} paddingX={1}>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { GeminiClient } from '../../core/gemini-client.js';
|
|||
import { type Chat, type PartListUnion } from '@google/genai';
|
||||
import { HistoryItem } from '../types.js';
|
||||
import { processGeminiStream , StreamingState } from '../../core/gemini-stream.js';
|
||||
import { globalConfig } from '../../config/config.js';
|
||||
|
||||
const addHistoryItem = (
|
||||
setHistory: React.Dispatch<React.SetStateAction<HistoryItem[]>>,
|
||||
|
|
@ -34,7 +35,7 @@ export const useGeminiStream = (
|
|||
setInitError(null);
|
||||
if (!geminiClientRef.current) {
|
||||
try {
|
||||
geminiClientRef.current = new GeminiClient();
|
||||
geminiClientRef.current = new GeminiClient(globalConfig);
|
||||
} catch (error: any) {
|
||||
setInitError(
|
||||
`Failed to initialize client: ${error.message || 'Unknown error'}`,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue