Merge pull request #509 from devchat-ai/feature/optimize-code-completion-devchat-#365
Optimize devchat code completion to automatically use configured server
This commit is contained in:
commit
63ae50a819
@ -18,14 +18,10 @@ export interface CodeCompletionChunk {
|
||||
export async function* streamComplete(prompt: string): AsyncGenerator<CodeCompletionChunk> {
|
||||
const nvidiaKey = DevChatConfig.getInstance().get("complete_key");
|
||||
const ollamaApiBase = DevChatConfig.getInstance().get("complete_ollama_api_base");
|
||||
const devchatApiBase = DevChatConfig.getInstance().get("complete_devchat_api_base");
|
||||
const devchatToken = DevChatConfig.getInstance().get("providers.devchat.api_key");
|
||||
const devchatEndpoint = DevChatConfig.getInstance().get("providers.devchat.api_base");
|
||||
|
||||
if (devchatApiBase) {
|
||||
for await (const chunk of devchatComplete(prompt)) {
|
||||
yield chunk;
|
||||
}
|
||||
}
|
||||
else if (ollamaApiBase) {
|
||||
if (ollamaApiBase) {
|
||||
for await (const chunk of ollamaDeepseekComplete(prompt)) {
|
||||
yield chunk;
|
||||
}
|
||||
@ -33,6 +29,10 @@ export async function* streamComplete(prompt: string): AsyncGenerator<CodeComple
|
||||
for await (const chunk of nvidiaStarcoderComplete(prompt)) {
|
||||
yield chunk;
|
||||
}
|
||||
} else if (devchatToken && devchatEndpoint) {
|
||||
for await (const chunk of devchatComplete(prompt)) {
|
||||
yield chunk;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,8 +172,8 @@ export async function * ollamaDeepseekComplete(prompt: string) : AsyncGenerator<
|
||||
|
||||
|
||||
export async function * devchatComplete(prompt: string) : AsyncGenerator<CodeCompletionChunk> {
|
||||
const devchatApiBase = DevChatConfig.getInstance().get("complete_devchat_api_base");
|
||||
const completionApiBase = devchatApiBase + "/completions";
|
||||
const devchatEndpoint = DevChatConfig.getInstance().get("providers.devchat.api_base");
|
||||
const completionApiBase = devchatEndpoint + "/completions";
|
||||
|
||||
let model = DevChatConfig.getInstance().get("complete_model");
|
||||
if (!model) {
|
||||
|
2
tools
2
tools
@ -1 +1 @@
|
||||
Subproject commit 490dcffe01ab02b96032df9606d46f2add23d89e
|
||||
Subproject commit a2cd34022a4504862039564a92c5067385df419e
|
Loading…
x
Reference in New Issue
Block a user