Skip to content

Commit 81d038e

Browse files
committed
remove unlimited from chat
1 parent 21bcf2a commit 81d038e

3 files changed

Lines changed: 8 additions & 16 deletions

File tree

app/api/repo/[graph]/route.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
import { Graph, RedisClientType, createClient } from 'falkordb';
1+
import { Graph, createClient } from 'falkordb';
22
import { NextRequest, NextResponse } from "next/server";
33
import { graphSchema } from "../graph_ops";
44
import OpenAI from "openai";
55
import { ChatCompletionCreateParams, ChatCompletionMessageParam, ChatCompletionMessageToolCall, ChatCompletionTool } from 'openai/resources/chat/completions.mjs';
66
import { QUESTIONS } from '../questions';
77

8-
const LIMITED_MODE = process.env.NEXT_PUBLIC_MODE?.toLowerCase()==='limited';
9-
108
// convert a structured graph schema into a string representation
119
// used in a model prompt
1210
async function GraphSchemaToPrompt(
@@ -184,10 +182,6 @@ export async function GET(request: NextRequest, { params }: { params: { graph: s
184182
return NextResponse.json({ message: 'Question not specified' }, { status: 400 })
185183
}
186184

187-
if (LIMITED_MODE && !QUESTIONS.includes(question)) {
188-
return NextResponse.json({ message: 'Question not supported' }, { status: 401 })
189-
}
190-
191185
//-------------------------------------------------------------------------
192186
// Connect to graph
193187
//-------------------------------------------------------------------------

app/components/chat.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import { QUESTIONS } from "../api/repo/questions";
66
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
77
import Image from "next/image";
88

9-
const LIMITED_MODE = process.env.NEXT_PUBLIC_MODE?.toLowerCase()==='limited';
10-
119
enum MessageTypes {
1210
Query,
1311
Response,
@@ -130,7 +128,7 @@ export function Chat(props: { repo: string }) {
130128
{props.repo &&
131129
<form className="flex flex-row gap-2" onSubmit={handleQueryClick}>
132130
<Select onValueChange={onQuestionSelected}>
133-
<SelectTrigger className="min-w-1/3">
131+
<SelectTrigger className="w-1/3">
134132
<SelectValue placeholder="Suggested questions" />
135133
</SelectTrigger>
136134
<SelectContent>
@@ -141,9 +139,7 @@ export function Chat(props: { repo: string }) {
141139
}
142140
</SelectContent>
143141
</Select>
144-
{
145-
!LIMITED_MODE && <Input className="w-2/3" placeholder="Type a question..." onChange={handleQueryInputChange} />
146-
}
142+
<Input className="w-2/3" placeholder="Type a question..." onChange={handleQueryInputChange} />
147143
<Button>Send</Button>
148144
</form>
149145
}

app/components/code-graph.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,12 @@ export function CodeGraph(parmas: { onFetchGraph: (url: string) => void, onFetch
157157
</SelectContent>
158158
</Select>
159159
{
160-
!LIMITED_MODE && <Input placeholder="Github repo URL" className="border" type="url" onChange={handleRepoInputChange} />
160+
!LIMITED_MODE &&
161+
<>
162+
<Input placeholder="Github repo URL" className="border" type="url" onChange={handleRepoInputChange} />
163+
<Button type="submit">Send</Button>
164+
</>
161165
}
162-
<Button type="submit">Send</Button>
163166
</form>
164167
</header>
165168
<main className="h-full w-full">
@@ -228,7 +231,6 @@ export function CodeGraph(parmas: { onFetchGraph: (url: string) => void, onFetch
228231
<Skeleton className="h-4 w-[200px] bg-gray-600" />
229232
</div>
230233
</div>
231-
232234
</div>
233235
)
234236
}

0 commit comments

Comments
 (0)