repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | import { createSlice, PayloadAction } from '@reduxjs/toolkit'; |
| #2 | |
| #3 | export interface LLMConfig { |
| #4 | model: string; |
| #5 | temperature: number; |
| #6 | max_tokens: number; |
| #7 | api_key?: string; |
| #8 | ollama_base_url?: string; |
| #9 | } |
| #10 | |
| #11 | export interface LLMProvider { |
| #12 | provider: string; |
| #13 | config: LLMConfig; |
| #14 | } |
| #15 | |
| #16 | export interface EmbedderConfig { |
| #17 | model: string; |
| #18 | api_key?: string; |
| #19 | ollama_base_url?: string; |
| #20 | } |
| #21 | |
| #22 | export interface EmbedderProvider { |
| #23 | provider: string; |
| #24 | config: EmbedderConfig; |
| #25 | } |
| #26 | |
| #27 | export interface Mem0Config { |
| #28 | llm?: LLMProvider; |
| #29 | embedder?: EmbedderProvider; |
| #30 | } |
| #31 | |
| #32 | export interface OpenMemoryConfig { |
| #33 | custom_instructions?: string | null; |
| #34 | } |
| #35 | |
| #36 | export interface ConfigState { |
| #37 | openmemory: OpenMemoryConfig; |
| #38 | mem0: Mem0Config; |
| #39 | status: 'idle' | 'loading' | 'succeeded' | 'failed'; |
| #40 | error: string | null; |
| #41 | } |
| #42 | |
| #43 | const initialState: ConfigState = { |
| #44 | openmemory: { |
| #45 | custom_instructions: null, |
| #46 | }, |
| #47 | mem0: { |
| #48 | llm: { |
| #49 | provider: 'openai', |
| #50 | config: { |
| #51 | model: 'gpt-4o-mini', |
| #52 | temperature: 0.1, |
| #53 | max_tokens: 2000, |
| #54 | api_key: 'env:OPENAI_API_KEY', |
| #55 | }, |
| #56 | }, |
| #57 | embedder: { |
| #58 | provider: 'openai', |
| #59 | config: { |
| #60 | model: 'text-embedding-3-small', |
| #61 | api_key: 'env:OPENAI_API_KEY', |
| #62 | }, |
| #63 | }, |
| #64 | }, |
| #65 | status: 'idle', |
| #66 | error: null, |
| #67 | }; |
| #68 | |
| #69 | const configSlice = createSlice({ |
| #70 | name: 'config', |
| #71 | initialState, |
| #72 | reducers: { |
| #73 | setConfigLoading: (state) => { |
| #74 | state.status = 'loading'; |
| #75 | state.error = null; |
| #76 | }, |
| #77 | setConfigSuccess: (state, action: PayloadAction<{ openmemory?: OpenMemoryConfig; mem0: Mem0Config }>) => { |
| #78 | if (action.payload.openmemory) { |
| #79 | state.openmemory = action.payload.openmemory; |
| #80 | } |
| #81 | state.mem0 = action.payload.mem0; |
| #82 | state.status = 'succeeded'; |
| #83 | state.error = null; |
| #84 | }, |
| #85 | setConfigError: (state, action: PayloadAction<string>) => { |
| #86 | state.status = 'failed'; |
| #87 | state.error = action.payload; |
| #88 | }, |
| #89 | updateOpenMemory: (state, action: PayloadAction<OpenMemoryConfig>) => { |
| #90 | state.openmemory = action.payload; |
| #91 | }, |
| #92 | updateLLM: (state, action: PayloadAction<LLMProvider>) => { |
| #93 | state.mem0.llm = action.payload; |
| #94 | }, |
| #95 | updateEmbedder: (state, action: PayloadAction<EmbedderProvider>) => { |
| #96 | state.mem0.embedder = action.payload; |
| #97 | }, |
| #98 | updateMem0Config: (state, action: PayloadAction<Mem0Config>) => { |
| #99 | state.mem0 = action.payload; |
| #100 | }, |
| #101 | }, |
| #102 | }); |
| #103 | |
| #104 | export const { |
| #105 | setConfigLoading, |
| #106 | setConfigSuccess, |
| #107 | setConfigError, |
| #108 | updateOpenMemory, |
| #109 | updateLLM, |
| #110 | updateEmbedder, |
| #111 | updateMem0Config, |
| #112 | } = configSlice.actions; |
| #113 | |
| #114 | export default configSlice.reducer; |