Skip to content

Commit 20f7f3c

Browse files
committed
Remove references to staging table in PostgresSearcher and PostgresModels
1 parent 7f1578f commit 20f7f3c

File tree

8 files changed

+21
-22
lines changed

8 files changed

+21
-22
lines changed

src/fastapi_app/postgres_models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Base(DeclarativeBase, MappedAsDataclass):
1111

1212

1313
class Package(Base):
14-
__tablename__ = "packages_all_staging"
14+
__tablename__ = "packages_all"
1515
package_name: Mapped[str] = mapped_column()
1616
package_picture: Mapped[str] = mapped_column()
1717
url: Mapped[str] = mapped_column(primary_key=True)
@@ -54,7 +54,7 @@ class Package(Base):
5454

5555
def to_dict(self):
5656
return asdict(self)
57-
57+
5858
def to_str_for_broad_rag(self):
5959
return f"""
6060
package_name: {self.package_name}

src/fastapi_app/postgres_searcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async def simple_sql_search(self, filters: list[dict]) -> list[Package]:
3131
"""
3232
filter_clause_where, _ = self.build_filter_clause(filters, use_or=True)
3333
sql = f"""
34-
SELECT url FROM packages_all_staging
34+
SELECT url FROM packages_all
3535
{filter_clause_where}
3636
LIMIT 10
3737
"""

src/fastapi_app/seed_hd_data.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ def convert_to_str(value):
4141

4242

4343
async def seed_data(engine):
44-
logger.info("Checking if the packages_all_staging table exists...")
44+
logger.info("Checking if the packages_all table exists...")
4545
async with engine.begin() as conn:
4646
result = await conn.execute(
4747
text(
4848
"""
4949
SELECT EXISTS
50-
(SELECT 1 FROM information_schema.tables WHERE table_schema = 'public' AND table_name = 'packages_all_staging')
50+
(SELECT 1 FROM information_schema.tables WHERE table_schema = 'public' AND table_name = 'packages_all')
5151
""" # noqa
5252
)
5353
)
@@ -102,7 +102,6 @@ async def seed_data(engine):
102102

103103
item_data = {key: value for key, value in record.items() if key in Package.__table__.columns}
104104

105-
106105
for key, value in item_data.items():
107106
if key not in [
108107
"price",

src/frontend/src/components/Answer/Answer.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const Answer = ({
3737

3838
return (
3939
<Stack className={`${styles.answerContainer} ${isSelected && styles.selected}`} verticalAlign="space-between">
40-
<Stack.Package>
40+
<Stack.Item>
4141
<Stack horizontal horizontalAlign="space-between">
4242
<AnswerIcon />
4343
<div>
@@ -59,14 +59,14 @@ export const Answer = ({
5959
/>
6060
</div>
6161
</Stack>
62-
</Stack.Package>
62+
</Stack.Item>
6363

64-
<Stack.Package grow>
64+
<Stack.Item grow>
6565
<div className={styles.answerText} dangerouslySetInnerHTML={{ __html: sanitizedAnswerHtml }}></div>
66-
</Stack.Package>
66+
</Stack.Item>
6767

6868
{!!parsedAnswer.citations.length && (
69-
<Stack.Package>
69+
<Stack.Item>
7070
<Stack horizontal wrap tokens={{ childrenGap: 5 }}>
7171
<span className={styles.citationLearnMore}>Citations:</span>
7272
{parsedAnswer.citations.map((x, i) => {
@@ -77,11 +77,11 @@ export const Answer = ({
7777
);
7878
})}
7979
</Stack>
80-
</Stack.Package>
80+
</Stack.Item>
8181
)}
8282

8383
{!!followupQuestions?.length && showFollowupQuestions && onFollowupQuestionClicked && (
84-
<Stack.Package>
84+
<Stack.Item>
8585
<Stack horizontal wrap className={`${!!parsedAnswer.citations.length ? styles.followupQuestionsList : ""}`} tokens={{ childrenGap: 6 }}>
8686
<span className={styles.followupQuestionLearnMore}>Follow-up questions:</span>
8787
{followupQuestions.map((x, i) => {
@@ -92,7 +92,7 @@ export const Answer = ({
9292
);
9393
})}
9494
</Stack>
95-
</Stack.Package>
95+
</Stack.Item>
9696
)}
9797
</Stack>
9898
);

src/frontend/src/components/Answer/AnswerError.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ export const AnswerError = ({ error, onRetry }: Props) => {
1313
<Stack className={styles.answerContainer} verticalAlign="space-between">
1414
<ErrorCircle24Regular aria-hidden="true" aria-label="Error icon" primaryFill="red" />
1515

16-
<Stack.Package grow>
16+
<Stack.Item grow>
1717
<p className={styles.answerText}>{error}</p>
18-
</Stack.Package>
18+
</Stack.Item>
1919

2020
<PrimaryButton className={styles.retryButton} onClick={onRetry} text="Retry" />
2121
</Stack>

src/frontend/src/components/Answer/AnswerLoading.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ export const AnswerLoading = () => {
1414
<animated.div style={{ ...animatedStyles }}>
1515
<Stack className={styles.answerContainer} verticalAlign="space-between">
1616
<AnswerIcon />
17-
<Stack.Package grow>
17+
<Stack.Item grow>
1818
<p className={styles.answerText}>
1919
Generating answer
2020
<span className={styles.loadingdots} />
2121
</p>
22-
</Stack.Package>
22+
</Stack.Item>
2323
</Stack>
2424
</animated.div>
2525
);

src/frontend/src/components/SupportingContent/SupportingContentParser.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ type ParsedSupportingContentItem = {
55
content: string;
66
};
77

8-
export function parseSupportingContentItem(package: string): ParsedSupportingContentItem {
9-
// Assumes the package starts with the file name followed by : and the content.
8+
export function parseSupportingContentItem(item: string): ParsedSupportingContentItem {
9+
// Assumes the item starts with the file name followed by : and the content.
1010
// Example: "sdp_corporate.pdf: this is the content that follows".
11-
const parts = package.split(": ");
11+
const parts = item.split(": ");
1212
const title = parts[0];
1313
const content = DOMPurify.sanitize(parts.slice(1).join(": "));
1414

src/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ email_validator==2.1.1
2424
environs==11.0.0
2525
fastapi==0.111.0
2626
fastapi-cli==0.0.4
27-
-e git+https://github.com/chatrtham/rag-postgres-openai-python.git@c63d4e04d0043c99fc0eafd55a2116f2f4e36b5a#egg=fastapi_app&subdirectory=src
27+
-e git+https://github.com/chatrtham/rag-postgres-openai-python.git@7f1578f2d48381331570f68cc13167c3290ee097#egg=fastapi_app&subdirectory=src
2828
filelock==3.14.0
2929
fixedint==0.1.6
3030
frozenlist==1.4.1

0 commit comments

Comments
 (0)