Compare commits

...

7 Commits

Author SHA1 Message Date
Dot.L 3c29a0a5c6 Merge pull request #211 from APIParkLab/feature/1.5-local-model
This pull request includes several changes aimed at improving error handling, adding new functionalities, and refactoring existing code. The changes primarily focus on the AI provider and controller modules.

Error Handling Improvements:
Added checks to ensure the client is initialized before performing operations in multiple functions (PullModel, StopPull, CancelPipeline, RemoveModel, ModelsInstalled) in ai-provider/local/executor.go. [1] [2] [3] [4]
New Functionalities:
Introduced OllamaConfig and OllamaConfigUpdate methods to the ILocalModelController interface and implemented them in controller/ai-local/iml.go. These methods allow for getting and updating the Ollama configuration. [1] [2]
Added functionality to automatically subscribe all applications to new services in the Create method of controller/service/iml.go.
Refactoring:
Refactored the initialization of the Ollama client by replacing the static address with a ResetOllamaAddress function in ai-provider/local/local.go.
Removed unused code and imports, such as the newAIUpstream function and upstream_dto import in controller/service/iml.go. [1] [2]
Codebase Simplification:
Simplified the OnInit method in controller/system/iml.go by consolidating the creation of default entities and adding subscription logic. [1] [2] [3]
Additional Changes:
Added new imports and modules to support the new functionalities and refactoring efforts. [1] [2] [3]
2025-02-20 14:31:31 +08:00
ningyv 06aa17d0c3 Merge pull request #210 from APIParkLab/feature/1.5-cx
feat: feature/1.5-Data Integration
2025-02-20 14:20:59 +08:00
ningyv 94503a4ab6 feat: feature/1.5-Data Integration 2025-02-20 14:19:34 +08:00
ningyv 718f37e0da Merge pull request #209 from APIParkLab/feature/1.5-cx
feat: feature/1.5-Data Integration
2025-02-20 13:52:50 +08:00
ningyv 587eec4f15 feat: feature/1.5-Data Integration 2025-02-20 13:51:53 +08:00
ningyv e760ce953b Merge pull request #208 from APIParkLab/feature/1.5-cx
feat: feature/1.5-Data Integration
2025-02-20 11:37:47 +08:00
ningyv 5759195b23 feat: feature/1.5-Data Integration 2025-02-20 11:36:34 +08:00
4 changed files with 23 additions and 5 deletions
@@ -22,6 +22,7 @@ class InsidePageProps {
headerClassName?: string = ''
/** 整个页面滚动 */
scrollPage?: boolean = true
scrollInsidePage?: boolean = false
customPadding?: boolean
customBtn?: ReactNode
}
@@ -42,6 +43,7 @@ const InsidePage: FC<InsidePageProps> = ({
contentClassName = '',
headerClassName = '',
scrollPage = true,
scrollInsidePage = false,
customPadding = false,
customBtn
}) => {
@@ -51,7 +53,9 @@ const InsidePage: FC<InsidePageProps> = ({
navigate(backUrl || '/')
}
return (
<div className={`flex overflow-hidden flex-col flex-1 h-full ${className}`}>
<div
className={`flex flex-col flex-1 h-full ${scrollInsidePage ? 'overflow-auto' : 'overflow-hidden'} ${className}`}
>
{showBanner && (
<div
className={`border-[0px] mr-PAGE_INSIDE_X ${showBorder ? 'border-solid border-b-[1px] border-BORDER' : ''} ${headerClassName}`}
@@ -100,7 +104,9 @@ const InsidePage: FC<InsidePageProps> = ({
)}
</div>
)}
<div className={`h-full ${scrollPage ? 'overflow-hidden' : 'overflow-auto'} ${contentClassName || ''}`}>
<div
className={`h-full ${scrollInsidePage ? 'overflow-visible' : scrollPage ? 'overflow-hidden' : 'overflow-auto'} ${contentClassName || ''}`}
>
{children}
</div>
</div>
@@ -36,6 +36,7 @@ interface PageListProps<T> extends ProTableProps<T, unknown>, RefAttributes<Acti
primaryKey?: string
addNewBtnTitle?: string
addNewBtnAccess?: string
addNewBtnDisabled?: boolean
tableClickAccess?: string
onAddNewBtnClick?: () => void
beforeSearchNode?: React.ReactNode[]
@@ -75,6 +76,7 @@ const PageList = <T extends Record<string, unknown>>(
primaryKey = 'id',
addNewBtnTitle,
addNewBtnAccess,
addNewBtnDisabled = false,
tableClickAccess,
tableClass,
onAddNewBtnClick,
@@ -202,6 +204,7 @@ const PageList = <T extends Record<string, unknown>>(
<Button
type="primary"
className={`mr-btnrbase my-btnbase ${addNewBtnWrapperClass}`}
disabled={addNewBtnDisabled}
onClick={onAddNewBtnClick}
>
{addNewBtnTitle}
@@ -140,7 +140,6 @@ const LocalModelList: React.FC = () => {
return ConfigureOllamaServiceRef.current?.save().then((res) => {
if (res === true) {
getOllamaData()
pageListRef.current?.reload()
}
})
},
@@ -191,6 +190,7 @@ const LocalModelList: React.FC = () => {
if (response.code === STATUS_CODE.SUCCESS) {
setOllamaAddress(response.data?.config?.address || '')
pageListRef.current?.reload()
} else {
message.error(response.msg || $t(RESPONSE_TIPS.error))
}
@@ -286,6 +286,13 @@ const LocalModelList: React.FC = () => {
const requestList = async (params: any) => {
try {
if (!ollamaAddress) {
return {
data: [],
success: true,
total: 0
}
}
const response = await fetchData<BasicResponse<{ data: ModelListData[] }>>('model/local/list', {
method: 'GET',
eoParams: {
@@ -435,7 +442,7 @@ const LocalModelList: React.FC = () => {
ref={pageListRef}
rowKey="id"
tableClass="local-model-list"
customEmptyRender={customEmptyRender}
customEmptyRender={!ollamaAddress ? customEmptyRender : undefined}
request={requestList}
onSearchWordChange={(e) => {
setSearchWord(e.target.value)
@@ -449,6 +456,7 @@ const LocalModelList: React.FC = () => {
columns={columns}
addNewBtnTitle={$t('部署模型')}
onAddNewBtnClick={handleAdd}
addNewBtnDisabled={!ollamaAddress}
/>
)
}
@@ -185,12 +185,13 @@ export default function Guide() {
}
showBorder={false}
scrollPage={false}
scrollInsidePage={true}
customPadding={true}
headerClassName="pt-[30px] pl-[40px]"
contentClassName=" w-full pr-PAGE_INSIDE_X pb-PAGE_INSIDE_B pl-[40px]"
>
<AIModelGuide></AIModelGuide>
<div className="flex flex-col gap-[15px]">
<div className="flex flex-col gap-[15px] pb-PAGE_INSIDE_B">
{showGuide && (
<Collapse
size="large"