pull/5371/head
bunsenstraat 2 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',
description: 'Remix IDE popup panel',
version: packageJson.version,
events: ['popupPanelShown'],
events: [],
methods: ['addView', 'removeView', 'showContent', 'showPopupPanel']
}
type popupPanelState = {

@ -10,10 +10,6 @@ import { PluginViewWrapper } from '@remix-ui/helper'
type chatRequestBufferT<T> = {
[key in keyof T]: T[key]
}
enum AIChatViewState {
minimized = 0,
open = 1
}
const profile = {
name: 'remixAI',
@ -53,7 +49,7 @@ export class RemixAIPlugin extends ViewPlugin {
}
onActivation(): void {
//this.renderComponent(AIChatViewState.open)
if (this.isOnDesktop) {
console.log('Activating RemixAIPlugin on desktop')
// this.on(this.remixDesktopPluginName, 'activated', () => {
@ -66,10 +62,6 @@ export class RemixAIPlugin extends ViewPlugin {
this.initialize()
}
}
toggle (open: AIChatViewState) {
this.renderComponent(open)
}
async initialize(model1?:IModel, model2?:IModel, remoteModel?:IRemoteModel, useRemote?:boolean){
if (this.isOnDesktop && !this.useRemoteInferencer) {
@ -220,13 +212,12 @@ export class RemixAIPlugin extends ViewPlugin {
setDispatch(dispatch) {
this.dispatch = dispatch
this.renderComponent(AIChatViewState.open)
this.renderComponent()
}
renderComponent (open: AIChatViewState) {
renderComponent () {
this.dispatch({
plugin: this,
openState: open
})
}
@ -247,7 +238,7 @@ export class RemixAIPlugin extends ViewPlugin {
updateComponent(state) {
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>,
ProcessChatRequestBuffer(params:IParams): 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 { IDgitPlugin } from "./plugins/dgitplugin-api"
import { Api } from "@remixproject/plugin-utils";
import { IPopupPanelAPI } from "./plugins/popuppanel-api"
export interface ICustomRemixApi extends IRemixApi {
popupPanel: {
methods: ['showPopupPanel']
events: ['popupPanelShown']
showPopupPanel(): void
} & Api
popupPanel: IPopupPanelAPI
dgitApi: IGitApi
dgit: IDgitPlugin
config: IConfigApi

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

@ -1,7 +1,8 @@
// eslint-disable-next-line @nrwl/nx/enforce-module-boundaries
import { StatusBar } from 'apps/remix-ide/src/app/components/status-bar'
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 {
plugin: StatusBar
@ -12,7 +13,7 @@ interface AIStatusProps {
export default function AIStatus(props: AIStatusProps) {
const [copilotActive, setCopilotActive] = useState(false)
const appContext = useContext(AppContext)
useEffect(() => {
const run = async () => {
@ -21,9 +22,6 @@ export default function AIStatus(props: AIStatusProps) {
}
run()
return () => {
props.plugin.off('popupPanel', 'popupPanelShown')
}
}, [])
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'
onClick={async () => {
await props.plugin.call('popupPanel', 'showPopupPanel', true)
appContext.appStateDispatch({
type: appActionTypes.setShowPopupPanel,
payload: !appContext.appState.showPopupPanel
})
}}
>

Loading…
Cancel
Save