Skip to content

Commit

Permalink
Update CLI argument parsing to use 'parseCLIArgs'
Browse files Browse the repository at this point in the history
  • Loading branch information
transitive-bullshit committed Feb 23, 2024
1 parent 26444a8 commit f881ee9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions bin/debug-answer-engine.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type * as types from '../src/types.js'
import { createAnswerEngine } from '../src/answer-engine-utils.js'
import { resolveCLIArgs } from '../src/cli-utils.js'
import { openaiClient } from '../src/openai-client.js'
import { parseCLIArgs } from '../src/parse-cli-args.js'
import { respondToNewMentions } from '../src/respond-to-new-mentions.js'
import { getTwitterClient } from '../src/twitter-client.js'
import { assert } from '../src/utils.js'
Expand All @@ -14,7 +14,7 @@ import { assert } from '../src/utils.js'
* ```
*/
async function main() {
const argv = resolveCLIArgs({
const argv = parseCLIArgs({
name: 'debug-answer-engine',
forceReply: true
})
Expand Down
4 changes: 2 additions & 2 deletions bin/xbot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import delay from 'delay'
import * as db from '../src/db.js'
import type * as types from '../src/types.js'
import { createAnswerEngine } from '../src/answer-engine-utils.js'
import { resolveCLIArgs } from '../src/cli-utils.js'
import { openaiClient } from '../src/openai-client.js'
import { parseCLIArgs } from '../src/parse-cli-args.js'
import { respondToNewMentions } from '../src/respond-to-new-mentions.js'
import { getTwitterClient } from '../src/twitter-client.js'
import { maxTwitterId } from '../src/twitter-utils.js'
Expand All @@ -16,7 +16,7 @@ import { maxTwitterId } from '../src/twitter-utils.js'
* responses to twitter.
*/
async function main() {
const argv = resolveCLIArgs()
const argv = parseCLIArgs()
const answerEngine = createAnswerEngine(
argv.flags.answerEngine as types.AnswerEngineType
)
Expand Down
5 changes: 3 additions & 2 deletions src/answer-engines/dexa-answer-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ export class DexaAnswerEngine extends AnswerEngine {
): Promise<string> {
return this._dexaClient.generateResponse({
// TODO: Dexa API is throwing 500 if we pass entities
messages: query.answerEngineMessages.map(({ entities, ...msg }) => msg)
// entityMap: query.entityMap
// messages: query.answerEngineMessages.map(({ entities, ...msg }) => msg)
messages: query.answerEngineMessages,
entityMap: query.entityMap
})
}
}
2 changes: 1 addition & 1 deletion src/cli-utils.ts → src/parse-cli-args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { cli } from 'cleye'

import * as config from './config.js'

export function resolveCLIArgs(
export function parseCLIArgs(
overrides?: Record<string, any>,
argv: string[] = process.argv
) {
Expand Down

0 comments on commit f881ee9

Please sign in to comment.