chore: Remove console logs and clean up code
This commit removes unnecessary console.log statements and makes minor code cleanup in several files: - PlantUML component - WebSearchSettings - WebSearchService - Store settings Additionally, it updates the store migration to handle LM Studio provider addition and reverts the store version
This commit is contained in:
parent
c7071a98f0
commit
68df5cd211
@ -136,9 +136,10 @@ const PlantUMLPopupCantaier: React.FC<PlantUMLPopupProps> = ({ resolve, diagram
|
|||||||
png: false,
|
png: false,
|
||||||
svg: false
|
svg: false
|
||||||
})
|
})
|
||||||
|
|
||||||
const [activeTab, setActiveTab] = useState('preview')
|
const [activeTab, setActiveTab] = useState('preview')
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
console.log(`plantuml diagram: ${diagram}`)
|
|
||||||
const encodedDiagram = encodeDiagram(diagram)
|
const encodedDiagram = encodeDiagram(diagram)
|
||||||
const onOk = () => {
|
const onOk = () => {
|
||||||
setOpen(false)
|
setOpen(false)
|
||||||
|
|||||||
@ -33,7 +33,6 @@ const WebSearchSettings: FC = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
return () => {
|
return () => {
|
||||||
console.log('apiKey', apiKey, provider.apiKey)
|
|
||||||
if (apiKey && apiKey !== provider.apiKey) {
|
if (apiKey && apiKey !== provider.apiKey) {
|
||||||
updateProvider({ ...provider, apiKey })
|
updateProvider({ ...provider, apiKey })
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,14 +25,15 @@ class WebSearchService {
|
|||||||
|
|
||||||
public async search(query: string) {
|
public async search(query: string) {
|
||||||
const searchWithTime = store.getState().websearch.searchWithTime
|
const searchWithTime = store.getState().websearch.searchWithTime
|
||||||
console.log('searchWithTime', searchWithTime)
|
|
||||||
let formatted_query = query
|
let formatted_query = query
|
||||||
|
|
||||||
if (searchWithTime) {
|
if (searchWithTime) {
|
||||||
formatted_query = `today is ${dayjs().format('YYYY-MM-DD')} \r\n ${query}`
|
formatted_query = `today is ${dayjs().format('YYYY-MM-DD')} \r\n ${query}`
|
||||||
}
|
}
|
||||||
console.log('formatted_query', formatted_query)
|
|
||||||
const provider = this.getWebSearchProvider()
|
const provider = this.getWebSearchProvider()
|
||||||
const tvly = tavily({ apiKey: provider.apiKey })
|
const tvly = tavily({ apiKey: provider.apiKey })
|
||||||
|
|
||||||
return await tvly.search(formatted_query, {
|
return await tvly.search(formatted_query, {
|
||||||
maxResults: 5
|
maxResults: 5
|
||||||
})
|
})
|
||||||
|
|||||||
@ -32,7 +32,7 @@ const persistedReducer = persistReducer(
|
|||||||
{
|
{
|
||||||
key: 'cherry-studio',
|
key: 'cherry-studio',
|
||||||
storage,
|
storage,
|
||||||
version: 73,
|
version: 72,
|
||||||
blacklist: ['runtime'],
|
blacklist: ['runtime'],
|
||||||
migrate
|
migrate
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1093,12 +1093,11 @@ const migrateConfig = {
|
|||||||
state.minapps.enabled.push(app)
|
state.minapps.enabled.push(app)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
// remove zhihu-zhiada
|
||||||
|
state.minapps.enabled = state.minapps.enabled.filter((app) => app.id !== 'zhihu-zhiada')
|
||||||
|
state.minapps.disabled = state.minapps.disabled.filter((app) => app.id !== 'zhihu-zhiada')
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove zhihu-zhiada
|
|
||||||
state.minapps.enabled = state.minapps.enabled.filter((app) => app.id !== 'zhihu-zhiada')
|
|
||||||
state.minapps.disabled = state.minapps.disabled.filter((app) => app.id !== 'zhihu-zhiada')
|
|
||||||
|
|
||||||
state.settings.thoughtAutoCollapse = true
|
state.settings.thoughtAutoCollapse = true
|
||||||
|
|
||||||
return state
|
return state
|
||||||
@ -1123,7 +1122,21 @@ const migrateConfig = {
|
|||||||
return state
|
return state
|
||||||
},
|
},
|
||||||
'73': (state: RootState) => {
|
'73': (state: RootState) => {
|
||||||
state.websearch.searchWithTime = true
|
if (state.websearch) {
|
||||||
|
state.websearch.searchWithTime = true
|
||||||
|
}
|
||||||
|
if (!state.llm.providers.find((provider) => provider.id === 'lmstudio')) {
|
||||||
|
state.llm.providers.push({
|
||||||
|
id: 'lmstudio',
|
||||||
|
name: 'LM Studio',
|
||||||
|
type: 'openai',
|
||||||
|
apiKey: '',
|
||||||
|
apiHost: 'http://localhost:1234',
|
||||||
|
models: SYSTEM_MODELS.lmstudio,
|
||||||
|
isSystem: true,
|
||||||
|
enabled: false
|
||||||
|
})
|
||||||
|
}
|
||||||
return state
|
return state
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -189,7 +189,6 @@ const settingsSlice = createSlice({
|
|||||||
},
|
},
|
||||||
setWindowStyle: (state, action: PayloadAction<'transparent' | 'opaque'>) => {
|
setWindowStyle: (state, action: PayloadAction<'transparent' | 'opaque'>) => {
|
||||||
state.windowStyle = action.payload
|
state.windowStyle = action.payload
|
||||||
console.log(state.windowStyle)
|
|
||||||
},
|
},
|
||||||
setTopicPosition: (state, action: PayloadAction<'left' | 'right'>) => {
|
setTopicPosition: (state, action: PayloadAction<'left' | 'right'>) => {
|
||||||
state.topicPosition = action.payload
|
state.topicPosition = action.payload
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user