-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add a nop replacement for remote Navie
This provider effectively disables remote Navie and prevents transmission of any data.
- Loading branch information
1 parent
c37308f
commit 42b446e
Showing
4 changed files
with
52 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import EventEmitter from 'events'; | ||
import { default as INavie } from './inavie'; | ||
|
||
export default class NopNavie extends EventEmitter implements INavie { | ||
public readonly providerName = 'nop'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
setOption(key: string, _value: string | number) { | ||
throw new Error(`NopNavie does not support option '${key}'`); | ||
} | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
ask(_threadId: string, _question: string, _codeSelection?: string, _prompt?: string) { | ||
this.emit( | ||
'error', | ||
new Error(`AppMap is transitioning to a fully open-source model where you bring your own LLM, giving you complete control and ensuring your data stays with you. | ||
With this change, the free hosted service is offline, but you can continue using Navie by configuring your own LLM provider. | ||
For guidance on using other LLM providers such as OpenAI and Copilot, [check out our documentation](https://appmap.io/docs/using-navie-ai/bring-your-own-model.html).`) | ||
); | ||
return Promise.resolve(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ | ||
import NopNavie from '../../../../src/rpc/explain/navie/navie-nop'; | ||
|
||
describe('NopNavie', () => { | ||
let navie: NopNavie; | ||
|
||
beforeEach(() => { | ||
navie = new NopNavie(); | ||
}); | ||
|
||
it('is disabled', async () => { | ||
const onError = jest.fn(); | ||
navie.on('error', onError); | ||
await navie.ask('threadId', 'question'); | ||
expect(onError).toHaveBeenCalledWith( | ||
expect.objectContaining({ | ||
message: expect.stringContaining('the free hosted service is offline'), | ||
}) | ||
); | ||
}); | ||
}); |