pull/5371/head
bunsenstraat 3 weeks ago committed by bunsenstraat
parent f8667db195
commit fac93dc375
  1. 2
      apps/remix-ide/src/app/components/popup-panel.tsx
  2. 17
      apps/remix-ide/src/app/plugins/remixAIPlugin.tsx
  3. 10
      libs/remix-api/src/lib/plugins/popuppanel-api.ts
  4. 1
      libs/remix-api/src/lib/plugins/remixai-api.ts
  5. 23
      libs/remix-api/src/lib/plugins/remixaiDesktop-api.ts
  6. 7
      libs/remix-api/src/lib/remix-api.ts
  7. 6
      libs/remix-ui/remix-ai/src/lib/components/RemixAI.tsx
  8. 13
      libs/remix-ui/statusbar/src/lib/components/aiStatus.tsx

@ -12,7 +12,7 @@ const profile = {
displayName: 'Popup Panel', displayName: 'Popup Panel',
description: 'Remix IDE popup panel', description: 'Remix IDE popup panel',
version: packageJson.version, version: packageJson.version,
events: ['popupPanelShown'], events: [],
methods: ['addView', 'removeView', 'showContent', 'showPopupPanel'] methods: ['addView', 'removeView', 'showContent', 'showPopupPanel']
} }
type popupPanelState = { type popupPanelState = {

@ -10,10 +10,6 @@ import { PluginViewWrapper } from '@remix-ui/helper'
type chatRequestBufferT<T> = { type chatRequestBufferT<T> = {
[key in keyof T]: T[key] [key in keyof T]: T[key]
} }
enum AIChatViewState {
minimized = 0,
open = 1
}
const profile = { const profile = {
name: 'remixAI', name: 'remixAI',
@ -53,7 +49,7 @@ export class RemixAIPlugin extends ViewPlugin {
} }
onActivation(): void { onActivation(): void {
//this.renderComponent(AIChatViewState.open)
if (this.isOnDesktop) { if (this.isOnDesktop) {
console.log('Activating RemixAIPlugin on desktop') console.log('Activating RemixAIPlugin on desktop')
// this.on(this.remixDesktopPluginName, 'activated', () => { // this.on(this.remixDesktopPluginName, 'activated', () => {
@ -67,10 +63,6 @@ export class RemixAIPlugin extends ViewPlugin {
} }
} }
toggle (open: AIChatViewState) {
this.renderComponent(open)
}
async initialize(model1?:IModel, model2?:IModel, remoteModel?:IRemoteModel, useRemote?:boolean){ async initialize(model1?:IModel, model2?:IModel, remoteModel?:IRemoteModel, useRemote?:boolean){
if (this.isOnDesktop && !this.useRemoteInferencer) { if (this.isOnDesktop && !this.useRemoteInferencer) {
// on desktop use remote inferencer -> false // on desktop use remote inferencer -> false
@ -220,13 +212,12 @@ export class RemixAIPlugin extends ViewPlugin {
setDispatch(dispatch) { setDispatch(dispatch) {
this.dispatch = dispatch this.dispatch = dispatch
this.renderComponent(AIChatViewState.open) this.renderComponent()
} }
renderComponent (open: AIChatViewState) { renderComponent () {
this.dispatch({ this.dispatch({
plugin: this, plugin: this,
openState: open
}) })
} }
@ -247,7 +238,7 @@ export class RemixAIPlugin extends ViewPlugin {
updateComponent(state) { updateComponent(state) {
return ( return (
<RemixAITab plugin={state.plugin} openState={state.openState}></RemixAITab> <RemixAITab plugin={state.plugin}></RemixAITab>
) )
} }
} }

@ -0,0 +1,10 @@
import { IFilePanel } from '@remixproject/plugin-api'
import { StatusEvents } from '@remixproject/plugin-utils'
export interface IPopupPanelAPI {
events:{
} & StatusEvents
methods: {
showPopupPanel(state: boolean): void
}
}

@ -19,6 +19,5 @@ export interface IRemixAI {
chatPipe(pipeMessage: string): Promise<void>, chatPipe(pipeMessage: string): Promise<void>,
ProcessChatRequestBuffer(params:IParams): Promise<void>, ProcessChatRequestBuffer(params:IParams): Promise<void>,
initialize(model1?:IModel, model2?:IModel, remoteModel?:IRemoteModel, useRemote?:boolean): Promise<void>, initialize(model1?:IModel, model2?:IModel, remoteModel?:IRemoteModel, useRemote?:boolean): Promise<void>,
toggle(boolean)
} }
} }

@ -1,23 +0,0 @@
import { IParams } from "@remix/remix-ai-core";
import { StatusEvents } from "@remixproject/plugin-utils";
export interface IRemixAID {
events: {
activated():void,
onInference():void,
onInferenceDone():void,
onStreamResult(streamText: string):void,
} & StatusEvents,
methods: {
code_completion(context: string): Promise<string>
code_insertion(msg_pfx: string, msg_sfx: string): Promise<string>,
code_generation(prompt: string): Promise<string | null>,
code_explaining(code: string, context?: string): Promise<string | null>,
error_explaining(prompt: string): Promise<string | null>,
solidity_answer(prompt: string): Promise<string | null>,
initializeModelBackend(local: boolean, generalModel?, completionModel?): Promise<boolean>,
chatPipe(pipeMessage: string): Promise<void>,
ProcessChatRequestBuffer(params:IParams): Promise<void>,
}
}

@ -18,14 +18,11 @@ import { IRemixAID } from "./plugins/remixAIDesktop-api"
import { IMenuIconsApi } from "./plugins/menuicons-api" import { IMenuIconsApi } from "./plugins/menuicons-api"
import { IDgitPlugin } from "./plugins/dgitplugin-api" import { IDgitPlugin } from "./plugins/dgitplugin-api"
import { Api } from "@remixproject/plugin-utils"; import { Api } from "@remixproject/plugin-utils";
import { IPopupPanelAPI } from "./plugins/popuppanel-api"
export interface ICustomRemixApi extends IRemixApi { export interface ICustomRemixApi extends IRemixApi {
popupPanel: { popupPanel: IPopupPanelAPI
methods: ['showPopupPanel']
events: ['popupPanelShown']
showPopupPanel(): void
} & Api
dgitApi: IGitApi dgitApi: IGitApi
dgit: IDgitPlugin dgit: IDgitPlugin
config: IConfigApi config: IConfigApi

@ -1,13 +1,9 @@
import React, { useContext } from 'react' import React, { useContext } from 'react'
import '../remix-ai.css' import '../remix-ai.css'
import { Default, ChatApi } from './Default' import { Default, ChatApi } from './Default'
enum AIChatViewState {
minimized = 0,
open = 1
}
interface IRemixAITab { interface IRemixAITab {
plugin: any, plugin: any,
openState: AIChatViewState
} }
export const RemixAITab = (props: IRemixAITab) => { export const RemixAITab = (props: IRemixAITab) => {

@ -1,7 +1,8 @@
// eslint-disable-next-line @nrwl/nx/enforce-module-boundaries // eslint-disable-next-line @nrwl/nx/enforce-module-boundaries
import { StatusBar } from 'apps/remix-ide/src/app/components/status-bar' import { StatusBar } from 'apps/remix-ide/src/app/components/status-bar'
import { CustomTooltip } from '@remix-ui/helper' import { CustomTooltip } from '@remix-ui/helper'
import React, { useEffect, useState } from 'react' import React, { useContext, useEffect, useState } from 'react'
import { appActionTypes, AppContext } from '@remix-ui/app'
interface AIStatusProps { interface AIStatusProps {
plugin: StatusBar plugin: StatusBar
@ -12,7 +13,7 @@ interface AIStatusProps {
export default function AIStatus(props: AIStatusProps) { export default function AIStatus(props: AIStatusProps) {
const [copilotActive, setCopilotActive] = useState(false) const [copilotActive, setCopilotActive] = useState(false)
const appContext = useContext(AppContext)
useEffect(() => { useEffect(() => {
const run = async () => { const run = async () => {
@ -21,9 +22,6 @@ export default function AIStatus(props: AIStatusProps) {
} }
run() run()
return () => {
props.plugin.off('popupPanel', 'popupPanelShown')
}
}, []) }, [])
useEffect(() => { useEffect(() => {
@ -65,7 +63,10 @@ export default function AIStatus(props: AIStatusProps) {
}} }}
className='p-1 alert alert-info border border-info fa-solid fa-message-bot' className='p-1 alert alert-info border border-info fa-solid fa-message-bot'
onClick={async () => { onClick={async () => {
await props.plugin.call('popupPanel', 'showPopupPanel', true) appContext.appStateDispatch({
type: appActionTypes.setShowPopupPanel,
payload: !appContext.appState.showPopupPanel
})
}} }}
> >

Loading…
Cancel
Save