Skip to content

Commit

Permalink
chore: small updates after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyrxng committed Nov 27, 2024
1 parent b26b9d4 commit d5f3827
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 51 deletions.
26 changes: 5 additions & 21 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
"version": "0.2",
"ignorePaths": [
"**/*.json",
"**/*.css",
"node_modules",
"**/*.log",
"src/adapters/github/storage-layer.ts"
],
"ignorePaths": ["**/*.json", "**/*.css", "node_modules", "**/*.log", "src/adapters/github/storage-layer.ts"],
"useGitignore": true,
"language": "en",
"words": [
Expand Down Expand Up @@ -61,17 +55,7 @@
"newtask",
"supergroup"
],
"dictionaries": [
"typescript",
"node",
"software-terms"
],
"import": [
"@cspell/dict-typescript/cspell-ext.json",
"@cspell/dict-node/cspell-ext.json",
"@cspell/dict-software-terms"
],
"ignoreRegExpList": [
"[0-9a-fA-F]{6}"
]
}
"dictionaries": ["typescript", "node", "software-terms"],
"import": ["@cspell/dict-typescript/cspell-ext.json", "@cspell/dict-node/cspell-ext.json", "@cspell/dict-software-terms"],
"ignoreRegExpList": ["[0-9a-fA-F]{6}"]
}
6 changes: 1 addition & 5 deletions src/adapters/openai/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class Completions {
}): OpenAI.Chat.Completions.ChatCompletionMessageParam[] {
return [
{
role: "system",
role: "user",
content: `You are UbiquityOS, a Telegram-integrated GitHub-first assistant for UbiquityDAO.
# Directives
Expand Down Expand Up @@ -94,11 +94,7 @@ export class Completions {
const res: OpenAI.Chat.Completions.ChatCompletion = await this.client.chat.completions.create({
model: params.model,
messages: ctxWindow,
temperature: 0.2,
max_completion_tokens: config.aiConfig.maxCompletionTokens,
top_p: 0.5,
frequency_penalty: 0,
presence_penalty: 0,
response_format: {
type: "text",
},
Expand Down
1 change: 0 additions & 1 deletion src/bot/features/commands/shared/ask-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ feature.command("ubiquityos", logHandle("command-ubiquityos"), chatAction("typin
}

const { similarityThreshold, model } = PluginContext.getInstance().config.aiConfig;

const similarText = await Promise.all([
embeddings.findSimilarComments(question, 1 - similarityThreshold),
embeddings.findSimilarIssues(question, 1 - similarityThreshold),
Expand Down
8 changes: 3 additions & 5 deletions src/bot/features/commands/shared/task-creation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ async function createTask(taskToCreate: string, ctx: GrammyContext, { owner, rep

const outputStyle = `{ "title": "Task Title", "body": "Task Body" }`;

const llmResponse = await ctx.adapters.ai.createCompletion({
const taskFromLlm = await ctx.adapters.ai.createCompletion({
embeddingsSearch: [],
directives,
constraints,
Expand All @@ -144,12 +144,10 @@ async function createTask(taskToCreate: string, ctx: GrammyContext, { owner, rep
query: taskToCreate,
});

if (!llmResponse) {
if (!taskFromLlm) {
return await ctx.reply("Failed to create task");
}

const taskFromLlm = llmResponse.answer;

let taskDetails;

try {
Expand Down Expand Up @@ -185,7 +183,7 @@ async function createTask(taskToCreate: string, ctx: GrammyContext, { owner, rep
return await ctx.reply("Failed to create task");
}

return await ctx.reply(`${fullSpec}\n\n [View on GitHub](${task.data.html_url})`);
return await ctx.reply(`${fullSpec}\n\n ${owner}/${repo}`);
}

export { composer as newTaskFeature };
2 changes: 1 addition & 1 deletion src/bot/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export async function createBot(token: string, dependencies: Dependencies, optio
...options.botConfig,
ContextConstructor: await createContextConstructor(dependencies),
client: {
timeoutSeconds: 20,
timeoutSeconds: 500,
},
});

Expand Down
20 changes: 9 additions & 11 deletions src/types/plugin-inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,19 @@ export const pluginSettingsSchema = T.Object({
aiConfig: T.Union(
[
T.Object({
kind: T.Literal("OpenAi"),
model: T.String({ default: "openai/o1-mini" }),
baseUrl: T.String({ default: "https://api.openai.com/v1" }),
maxCompletionTokens: T.Number({ default: 5000 }),
similarityThreshold: T.Number({ default: 0.9 }),
kind: T.Literal("OpenAi", { description: "The API provider you wish to use.", examples: ["OpenAi", "OpenRouter"] }),
model: T.String({ default: "o1-mini", description: "The model to use.", examples: ["o1-mini", "gpt-4o"] }),
baseUrl: T.String({ default: "https://api.openai.com/v1", description: "The base URL of the API.", examples: ["https://api.openai.com/v1", "https://api.openai.com/v2"] }),
similarityThreshold: T.Number({ default: 0.9, description: "The similarity threshold for when fetching embeddings-based context." }),
}),
T.Object({
kind: T.Literal("OpenRouter"),
model: T.String({ default: "openai/o1-mini" }),
baseUrl: T.String({ default: "https://openrouter.ai/api/v1" }),
maxCompletionTokens: T.Number({ default: 5000 }),
similarityThreshold: T.Number({ default: 0.9 }),
kind: T.Literal("OpenRouter", { description: "The API provider you wish to use.", examples: ["OpenAi", "OpenRouter"] }),
model: T.String({ default: "openai/o1-mini", description: "The model to use.", examples: ["openai/o1-mini", "openai/gpt-4o"] }),
baseUrl: T.String({ default: "https://openrouter.ai/api/v1", description: "The base URL of the API.", examples: ["https://openrouter.ai/api/v1", "https://openrouter.ai/api/v2"] }),
similarityThreshold: T.Number({ default: 0.9, description: "The similarity threshold for when fetching embeddings-based context." }),
}),
],
{ default: { kind: "OpenAi", model: "openai/o1-mini", baseUrl: "https://api.openai.com/v1" }, maxCompletionTokens: 5000 }
{ default: { kind: "OpenAi", model: "o1-mini", baseUrl: "https://api.openai.com/v1" } }
),
});

Expand Down
7 changes: 0 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5401,14 +5401,11 @@ formdata-node@^4.3.2:
node-domexception "1.0.0"
web-streams-polyfill "4.0.0-beta.3"

<<<<<<< HEAD
formdata-node@^6.0.3:
version "6.0.3"
resolved "https://registry.yarnpkg.com/formdata-node/-/formdata-node-6.0.3.tgz#48f8e2206ae2befded82af621ef015f08168dc6d"
integrity sha512-8e1++BCiTzUno9v5IZ2J6bv4RU+3UKDmqWUQD0MIMVCd9AdhWkO1gw57oo1mNEX1dMq2EGI+FbWz4B92pscSQg==

=======
>>>>>>> upstream/development
fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
Expand Down Expand Up @@ -7165,11 +7162,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5"
integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==

<<<<<<< HEAD
[email protected], node-fetch@^2.6.7, node-fetch@^2.7.0:
=======
node-fetch@^2.6.7, node-fetch@^2.7.0:
>>>>>>> upstream/development
version "2.7.0"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d"
integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==
Expand Down

0 comments on commit d5f3827

Please sign in to comment.