parent
046aa197a5
commit
8ed1077cb2
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1 @@ |
||||
{ "extends": "../../.eslintrc", "rules": {}, "ignorePatterns": ["!**/*"] } |
@ -0,0 +1,7 @@ |
||||
# remix-ai-core |
||||
|
||||
[![npm version](https://badge.fury.io/js/%40remix-project%2Fremixd.svg)](https://www.npmjs.com/package/@remix-project/remixd) |
||||
[![npm](https://img.shields.io/npm/dt/@remix-project/remixd.svg?label=Total%20Downloads&logo=npm)](https://www.npmjs.com/package/@remix-project/remixd) |
||||
[![npm](https://img.shields.io/npm/dw/@remix-project/remixd.svg?logo=npm)](https://www.npmjs.com/package/@remix-project/remixd) |
||||
|
||||
|
@ -0,0 +1,68 @@ |
||||
{ |
||||
"name": "@remix-project/remixd", |
||||
"version": "0.6.31", |
||||
"description": "remix server: allow accessing file system from remix.ethereum.org and start a dev environment (see help section)", |
||||
"main": "index.js", |
||||
"types": "./index.d.ts", |
||||
"bin": { |
||||
"remixd": "./src/bin/remixd.js" |
||||
}, |
||||
"publishConfig": { |
||||
"access": "public" |
||||
}, |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "git+https://github.com/ethereum/remix-project.git" |
||||
}, |
||||
"keywords": [ |
||||
"remix", |
||||
"ide", |
||||
"ethereum", |
||||
"solidity" |
||||
], |
||||
"author": "Remix Team", |
||||
"license": "MIT", |
||||
"bugs": { |
||||
"url": "https://github.com/ethereum/remix-project/issues" |
||||
}, |
||||
"homepage": "https://github.com/ethereum/remix-project#readme", |
||||
"dependencies": { |
||||
"@remixproject/plugin": "0.3.33", |
||||
"@remixproject/plugin-api": "0.3.33", |
||||
"@remixproject/plugin-utils": "0.3.33", |
||||
"@remixproject/plugin-ws": "0.3.33", |
||||
"axios": "1.6.0", |
||||
"chokidar": "^2.1.8", |
||||
"commander": "^9.4.1", |
||||
"fs-extra": "^3.0.1", |
||||
"isbinaryfile": "^3.0.2", |
||||
"latest-version": "^5.1.0", |
||||
"semver": "^6.3.0", |
||||
"ws": "^7.3.0" |
||||
}, |
||||
"python": { |
||||
"execPath": "python3", |
||||
"dependencies": { |
||||
"vyper": ">=0.1.0b3" |
||||
} |
||||
}, |
||||
"devDependencies": { |
||||
"@types/axios": "^0.14.0", |
||||
"@types/fs-extra": "^9.0.1", |
||||
"@types/node": "^18.16.1", |
||||
"@types/ws": "^7.2.4", |
||||
"@typescript-eslint/eslint-plugin": "^3.2.0", |
||||
"@typescript-eslint/parser": "^3.2.0", |
||||
"eslint": "6.8.0", |
||||
"eslint-config-standard": "14.1.1", |
||||
"eslint-plugin-import": "2.20.2", |
||||
"eslint-plugin-node": "11.1.0", |
||||
"eslint-plugin-promise": "4.2.1", |
||||
"eslint-plugin-standard": "4.0.1", |
||||
"nodemon": "^2.0.4", |
||||
"ts-node": "^8.10.1", |
||||
"typescript": "^3.9.3" |
||||
}, |
||||
"typings": "index.d.ts", |
||||
"gitHead": "ba6b2b226349d035146bd6deb120fef3d499ed16" |
||||
} |
@ -0,0 +1,31 @@ |
||||
{ |
||||
"name": "remix-ai-core", |
||||
"$schema": "../../node_modules/nx/schemas/project-schema.json", |
||||
"sourceRoot": "libs/remix-ai-core/src", |
||||
"projectType": "library", |
||||
"implicitDependencies": [ |
||||
], |
||||
"targets": { |
||||
"build": { |
||||
"executor": "@nrwl/js:tsc", |
||||
"outputs": ["{options.outputPath}"], |
||||
"options": { |
||||
"outputPath": "dist/libs/remix-ai-core", |
||||
"main": "libs/remix-ai-core/src/index.ts", |
||||
"tsConfig": "libs/remix-ai-core/tsconfig.lib.json", |
||||
"updateBuildableProjectDepsInPackageJson": false, |
||||
"assets": [ |
||||
"libs/remix-ai-core/*.md" |
||||
] |
||||
} |
||||
}, |
||||
"lint": { |
||||
"executor": "@nrwl/linter:eslint", |
||||
"outputs": ["{options.outputFile}"], |
||||
"options": { |
||||
"lintFilePatterns": ["libs/remix-ai-core/**/*.ts"] |
||||
} |
||||
} |
||||
}, |
||||
"tags": [] |
||||
} |
@ -0,0 +1,7 @@ |
||||
'use strict' |
||||
|
||||
import { Model, ModelResponse, ModelRequest, InferenceModel} from './types/types' |
||||
import { ModelType } from './types/constants'
|
||||
|
||||
|
||||
export { Model, ModelResponse, ModelRequest, InferenceModel } |
@ -0,0 +1,7 @@ |
||||
/// constants for modelselection
|
||||
|
||||
export enum ModelType { |
||||
CODE_COMPLETION = 'code_completion', |
||||
GENERAL = 'general', |
||||
} |
||||
|
@ -0,0 +1,20 @@ |
||||
// create a list of supported models
|
||||
// create a function getModels returning a list of all supported models
|
||||
// create a function getModel returning a model by its name
|
||||
|
||||
import { Model } from './types'; |
||||
|
||||
const supportedModels: Model[] = []; |
||||
|
||||
|
||||
const getModels = async (): Promise<Model[]> => { |
||||
return supportedModels; |
||||
} |
||||
|
||||
const getModel = async (name: string): Promise<Model | undefined> => { |
||||
return supportedModels.find(model => model.name === name); |
||||
} |
||||
|
||||
const loadModel = async (modelname: string): Promise<void> => { |
||||
console.log(`Loading model ${modelname}`); |
||||
} |
@ -0,0 +1,29 @@ |
||||
// model implementation for the model selection component
|
||||
|
||||
import exp from 'constants'; |
||||
import { ModelType } from './constants'; |
||||
|
||||
export interface Model { |
||||
name: string; |
||||
download_url: string; |
||||
type: ModelType; |
||||
url: string; |
||||
} |
||||
|
||||
export interface ModelResponse { |
||||
output: string; |
||||
error: string; |
||||
success: boolean; |
||||
model: Model; |
||||
} |
||||
|
||||
export interface ModelRequest { |
||||
input: string; |
||||
model: Model; |
||||
} |
||||
|
||||
export interface InferenceModel { |
||||
model: Model; |
||||
location: string; |
||||
isRemote: boolean; |
||||
} |
@ -0,0 +1,13 @@ |
||||
{ |
||||
"extends": "../../tsconfig.base.json", |
||||
"files": [], |
||||
"include": [], |
||||
"references": [ |
||||
{ |
||||
"path": "./tsconfig.lib.json" |
||||
}, |
||||
{ |
||||
"path": "./tsconfig.spec.json" |
||||
} |
||||
] |
||||
} |
@ -0,0 +1,13 @@ |
||||
{ |
||||
"extends": "./tsconfig.json", |
||||
"compilerOptions": { |
||||
"target": "es6", |
||||
"module": "commonjs", |
||||
"outDir": "../../dist/out-tsc", |
||||
"declaration": true, |
||||
"rootDir": "./src", |
||||
"types": ["node"] |
||||
}, |
||||
"exclude": ["**/*.spec.ts"], |
||||
"include": ["bin", "src", "bin/origins.json"] |
||||
} |
@ -0,0 +1,15 @@ |
||||
{ |
||||
"extends": "./tsconfig.json", |
||||
"compilerOptions": { |
||||
"outDir": "../../dist/out-tsc", |
||||
"module": "commonjs", |
||||
"types": ["node"] |
||||
}, |
||||
"include": [ |
||||
"**/*.spec.ts", |
||||
"**/*.spec.tsx", |
||||
"**/*.spec.js", |
||||
"**/*.spec.jsx", |
||||
"**/*.d.ts" |
||||
] |
||||
} |
@ -0,0 +1,79 @@ |
||||
// UI interface for selecting a model from a list of models
|
||||
// This component is used in the ModelSelectionModal component
|
||||
// It is a dropdown list of models that the user can select from
|
||||
// The user can also search for a specific model by typing in the search bar
|
||||
// The user can also filter the models by type
|
||||
// The user can select a model from the dropdown list
|
||||
// the panel controlling the model selection can be hidden or shown
|
||||
// Once selected, the model is either loaded from the local storage or downloaded
|
||||
// the remix ai desktop plugin provided the interface for storing the model in the local storage after downloading
|
||||
|
||||
|
||||
import React, { useState, useEffect } from 'react'; |
||||
import { Select, Input, Button, Icon } from 'antd'; |
||||
import { Model } from '@remix/remix-ai-core'; |
||||
import { getModels } from '../services'; |
||||
import { ModelType } from '@remix/remix-ai-core'; |
||||
import { useTranslation } from 'react-i18next'; |
||||
|
||||
const { Option } = Select; |
||||
const { Search } = Input; |
||||
|
||||
interface ModelSelectionProps { |
||||
onSelect: (model: Model) => void; |
||||
} |
||||
|
||||
export const ModelSelection: React.FC<ModelSelectionProps> = ({ onSelect }) => { |
||||
const { t } = useTranslation(); |
||||
const [models, setModels] = useState<Model[]>([]); |
||||
const [filteredModels, setFilteredModels] = useState<Model[]>([]); |
||||
const [search, setSearch] = useState<string>(''); |
||||
const [type, setType] = useState<ModelType | 'all'>('all'); |
||||
|
||||
useEffect(() => { |
||||
getModels().then(setModels); |
||||
}, []); |
||||
|
||||
useEffect(() => { |
||||
setFilteredModels(models.filter((model) => { |
||||
return model.name.toLowerCase().includes(search.toLowerCase()) && |
||||
(type === 'all' || model.type === type); |
||||
})); |
||||
}, [models, search, type]); |
||||
|
||||
return ( |
||||
<div> |
||||
<Search |
||||
placeholder={t('search_models')} |
||||
onChange={(e) => setSearch(e.target.value)} |
||||
style={{ width: 200, marginBottom: 10 }} |
||||
/> |
||||
<Select |
||||
defaultValue="all" |
||||
style={{ width: 200, marginBottom: 10 }} |
||||
onChange={(value) => setType(value)} |
||||
> |
||||
<Option value="all">{t('all_models')}</Option> |
||||
<Option value={ModelType.IMAGE}>{t('image_models')}</Option> |
||||
<Option value={ModelType.TEXT}>{t('text_models')}</Option> |
||||
<Option value={ModelType.AUDIO}>{t('audio_models')}</Option> |
||||
</Select> |
||||
<Select |
||||
showSearch |
||||
style={{ width: 200 }} |
||||
placeholder={t('select_model')} |
||||
optionFilterProp="children" |
||||
onChange={(value) => onSelect(models.find((model) => model.name === value))} |
||||
filterOption={(input, option) => |
||||
option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 |
||||
} |
||||
> |
||||
{filteredModels.map((model) => ( |
||||
<Option key={model.name} value={model.name}> |
||||
{model.name} |
||||
</Option> |
||||
))} |
||||
</Select> |
||||
</div> |
||||
); |
||||
}; |
Loading…
Reference in new issue