Skip to content

Commit c50a081

Browse files
committed
feat(ai-completions): use baseurl
1 parent a00089e commit c50a081

2 files changed

Lines changed: 5 additions & 9 deletions

File tree

packages/common/js/completion.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -188,17 +188,14 @@ const generateBaseReference = () => {
188188
}
189189

190190
const fetchAiInlineCompletion = (codeBeforeCursor, codeAfterCursor) => {
191-
const { modelName, url, baseUrl } = getMergeMeta('engine.plugins.pagecontroller')?.options?.AIModel || {}
191+
const { modelName, baseUrl } = getMergeMeta('engine.plugins.pagecontroller')?.options?.AIModel || {}
192192
const apiKey = import.meta.env.VITE_API_TPKEN
193-
if (!modelName || !apiKey) {
194-
throw new Error(`"modelName" & "apiKey" cannot be empty`)
195-
}
196-
if (!url && !baseUrl) {
197-
throw new Error(`"url" or "baseUrl" cannot be empty`)
193+
if (!modelName || !apiKey || !baseUrl) {
194+
throw new Error(`"modelName" & "apiKey" & "baseUrl" cannot be empty`)
198195
}
199196
const referenceContext = generateBaseReference()
200197
return getMetaApi(META_SERVICE.Http).post(
201-
url || `${baseUrl}/chat/completions`,
198+
`${baseUrl}/chat/completions`,
202199
{
203200
model: modelName,
204201
messages: [

packages/plugins/script/meta.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ export default {
99
enableAICompletion: true,
1010
AIModel: {
1111
modelName: 'qwen3-8b',
12-
baseUrl: 'https://agent.opentiny.design/api/v1/ai',
13-
url: ''
12+
baseUrl: 'https://agent.opentiny.design/api/v1/ai'
1413
}
1514
},
1615
confirm: 'close' // 当点击插件栏切换或关闭前是否需要确认, 会调用插件中confirm值指定的方法,e.g. 此处指向 close方法,会调用插件的close方法执行确认逻辑

0 commit comments

Comments
 (0)